Saturday, 4 August 2012

Support Landscape and Portrait using XIB (NIB) in iOS Interface Builder - GPOrientationKit


GPOrientationKIt

A Cocoa Static Library that Helps you develop USer Interface for iPad and iPhone using Interface Builder with Ease.







GPOrientationKit Class Reference: -


GPOrientation is a Cocoa Static Library to support Portrait
and Landscape for ViewController using Xib (NIB) file.

Current Version: v1.0



GPOrientation takes the View controller reference and
modifies the ViewObjects in Xib.
The Orientation Reference for the Library are either of the
two:

1. GPOrientationReferenceIndex. 2. GPOrientationReferenceTag.
GPOrientationReferenceIndex:



Here it takes the Orientation based on the Index of the
UIComponents added to the View. Below describes the following:





GPOrientaion Maps the Object on the Portrait View to the Objects in Landscape view based the Index. The Memory addresses of the UIObject in Portrait are then copied to the UIObjects in the Landscape Internally.
GPOrientationReferenceTag:
The Other way is Mapping of Objects using the Tag Values.
The UIObjects in the Portrait View are Mapped to to the UIOBjects in the Landscape.

Eg: -
A UIRoundRectButton in the Portrait View
UIRoundRectButton{
     tag = 1001;
     address = f74034h1;
}
Corresponding UIRoundRectButton in Landscape View
UIRoundRectButton{
     tag = 1001;
     address = g74054v3;
}
After Mapping
UIRoundRectButton{
     tag = 1001;
     address = f74034h1;
}


Class Reference:
Initializer:



GPOrienationDelegate
didChangeUIForOrientation is called after the operation is
done.

Version 2.0 Release Notes

- Stability Fixes.
- iOS 6 and iPhone 5 Support
- Increased performance
- Added Architecture from iOS 4.3
- Progressive rendering

Note :
- Do not use Auto layout
- Please make sure the Configuration.plist is added to the bundle with required fields.

Please file any bug report by commenting below. It will be taken care soon. And any queries on the Library.

Happy iCoding !!



The Library can be found here

Download GPOrientationKitV2.0


42 comments:

  1. I try to use your lib, but get error with device.

    ignoring file /Users/..../src/libGPOrientation.a, file was built for archive which is not the architecture being linked (armv7): /Users/...../src/libGPOrientation.a

    Can please you check archived build?

    ReplyDelete
  2. I really Apologize for the Inconvenience caused. The 1.0v seems to have too some linker issues. Hence i have now attached two libs for simulator and device. The 1.1V is under development.

    Regards
    Gautham
    LogiSian Inc.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Hi,

    I'm trying to use this library but can't seem to make it work on the iPad app. In the logger it says:
    2012-10-29 16:37:43.255 iPadTestApp[5492:c07] GPOrientationKit Debug Console : > unable to configure
    2012-10-29 16:37:43.256 iPadTestApp[5492:c07] GPOrientationKit Debug Console : > unable to configure

    What do you think is wrong?

    Thanks!

    ReplyDelete
    Replies
    1. Hi

      GPOrientationKit Debug Console : > unable to configure

      Means that your view is not tagged properly.

      Please give values in UIPortraitViews and UILandscapeViews in Configuration.plist

      and then make sure you use the same tag for your portrait and landscape views in XIB.

      Delete
    2. Thanks! I was able to make it work. By the way, I noticed a problem with navigation bar. It looses its dimension when changing orientations.

      Delete
    3. OH really ? Can you please give me more details

      Did u drag a navigation bar explicitly or is it a Navigation Controller ?

      It will help me to fix the issue in coming release.

      Delete
  5. I added the nav bar so basically it is not Navigation Controller. When I launch the app, the nav bar is okay. When rotating from portrait to landscape the width kind of grows to the right. When rotating to portrait from landscape, the nav bar's width shrinks by about 1/3 of its original width. The resizing also occurs on (sub-)UIView when changing orientation. I hope this helps.

    ReplyDelete
    Replies
    1. First of all thank you for showing interest. We really appreciate it

      Hi I did check with your inputs

      Please not the following things

      1. Please do not use any flexible resizing for SubViews in XIB using Autoresizing.
      2. Make sure the Indexes of the subviews Portrait view and Landscape view are the same. (as shown in the figure above)
      3. Make sure you have the Right tags for the right orientations
      Incase you wont the Library not to change the frame. You may have to override the delegate method.

      I hope this will help you. Thank You

      Delete
    2. Oh thanks! It is working! One more thing though, how about the font size, layout, and number of lines in a label?.. For example, on portrait I set the font to 30, layout is left-aligned, and number of lines to 1. On landscape, I set it to size 20, layout to right-aligned, and number of lines to 3. When a launch the app from portrait or landscape, the label settings for both portrait and landscape is the value set for portrait. Thanks for the great product!

      Delete
    3. Yes the Property of the UI Objects are not being mapped in the Current version. We are working on it to have better library soon.

      Thank you for your support :)

      Delete
  6. Currently does not support universal Apps... :-( This looks very promising!!! Can you update? The (c) in the code does not allow for free use. What is your plan?

    ld: file is universal (2 slices) but does not contain a(n) armv7s slice: /Development/BigGameRegs_mobile/Classes/CustomClasses/GPOrientation/libGPOrientation.a for architecture armv7s
    clang: error: linker command failed with exit code 1

    ReplyDelete
    Replies
    1. We will work on that will soon release a build for Universal support.

      Right now we have not kept the implementation editable may be in the future. Since its still under development. We promise to give a good release soon.

      Thank You
      LogiSian

      Delete
  7. How to align uitableviewcells according to the orientation in my view using this library??
    I am using a separate subclass of the uitableviewcells and load cell from nib file using loadNib call .

    How can i adjust the cell views orient correctly when changing the orientation when i load the table view using your library.

    ReplyDelete
    Replies
    1. Hey

      You can use the same way we use for UITableViewCells. With two cells tagged right.

      But I think using iOS SDK's auto resizing mask should do your job well. Since Table cells resize internally depending on the table view frame.

      Thanks

      Delete
  8. Hi

    What i can do when i have UIImage and that UIImage is other on landscape

    ReplyDelete
    Replies
    1. Thats a good question!

      Currently the library does not support properties of the object. So only objects the primary view will be shown in both landscape and portrait.

      Hopefully the future version will have the feature.

      Thanks
      LogiSian

      Delete
  9. I am using X-Code 4.5.2 and your library GPOrientationKitV2.0. I have set everything correct whatever you have mentioned above. There are two views in the .xib, portrait and landscape, but however when rotating from portrait to Landscape view the program is not calling(or displaying) the Landscape view from the .xib . Everytime the same portrait view shows up !!

    ReplyDelete
    Replies
    1. I think the problem is that yoo have to include configuration.plist file. And give tags to your portrait and landscape views. This will help

      Delete
    2. same problem i am facing, Everytime the same portrait view shows up because i think File Owner is connect with only portrait view, Landscape view is floating in river. so how Landscape will appear. Gautham Pai T please resolve the problem. or please send 1 demo app for ipad for ios 6, i'll be very thankfull to you. my id is vgupta@sd2labs.com

      Delete
    3. Having the same problem, please help on sending me demo app for iPad iOS6, thank you so much.
      JLjay07@hotmail.com

      Delete
  10. Hi,

    Is this free for use, what license agreement does it cover?

    Thanks,

    ReplyDelete
  11. Hi,

    First off this is awesome thank you so much.

    I found what might be a bug or maybe I missed something in the tutorial, but the portrait view has the to be the one with the view connected to the File's owner, it will not work if the landscape view is connected.

    ReplyDelete
    Replies
    1. Yes :) You are right. The documentation is still incomplete. Looking forward to create a good one.

      Thank you.

      Delete
  12. Hi

    Thanks for this great lib.
    Currently, my collabs and I, are looking for a skilled iOs
    coder like you.
    we'd be glad to have a talk,
    feel free to poke @ henry.icode (skype).

    Sincerely yours,
    Henry
    http://icode.cx

    ReplyDelete
  13. Hi Again,
    I get an issue at run, in spite of having imported all files (header, lib.a, config.plist) :
    I got a -[NSObject(NSObject) doesNotRecognizeSelector:] error on "delegate:self" :

    #begin
    2013-02-07 01:05:13.036 MYAPP[1559:907] GPOrientationKit Debug Console : Landscape view Configured
    2013-02-07 01:05:13.037 MYAPP[1559:907] GPOrientationKit Debug Console : Portrait view Configured
    2013-02-07 01:05:13.039 MYAPP[1559:907] -[UINavigationController tag]: unrecognized selector sent to instance 0x2103fd50
    2013-02-07 01:05:13.040 MYAPP[1559:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UINavigationController tag]: unrecognized selector sent to instance 0x2103fd50'
    #end

    Do you have any idea ?

    Many thanks

    ReplyDelete
    Replies
    1. Since the library is working based on tags here. Your UINavigationController is calling the tag property. May you might have missed something.

      Please let me know if you still could not find it.

      Delete
  14. Hi,

    I'm trying to use this library but can't seem to make it work on the iPad app. In the logger it says:
    2012-10-29 16:37:43.255 iPadTestApp[5492:c07] GPOrientationKit Debug Console : > unable to configure
    2012-10-29 16:37:43.256 iPadTestApp[5492:c07] GPOrientationKit Debug Console : > unable to configure

    i had configured the tag on configruation.plist but when i am running the app nothing is happening
    also i am using ios 6
    please help
    Thanks!

    ReplyDelete
  15. I'm getting the following link error when trying to add the gporientationkit to my project:

    ld: file is universal (2 slices) but does not contain a(n) armv7s slice: ........./libGPOrientation.a for architecture armv7s

    Any idea what the issue may be?

    ReplyDelete
  16. I have followed all the above instruction with GPOrientationV2.0, and when i run the app it shows only portrait view, and one think i like to know is when we create new landscape view for app, how it connect with our app.

    ReplyDelete
    Replies
    1. I am using Xcode version 4.5.2 and GPOrientationV2.0, but unable to see the landscape view which i have customized, only potrate view is shown,.

      Delete
  17. This comment has been removed by the author.

    ReplyDelete
  18. Is this class supporting the .storyboard? because i tried to on storyboard and it says;"Nib not found"

    ReplyDelete
    Replies
    1. ahh sorry , i didn't see the this part "to support Portrait and Landscape for ViewController using Xib (NIB) file."

      Delete
  19. I did everything as you described, plugged files, set the tags. But the app does not want to cooperate. And that's what it says


    2013-07-19 14:23:38.581 111[582:c07] GPOrientationKit Debug Console : Landscape view Configured
    2013-07-19 14:23:38.583 111[582:c07] GPOrientationKit Debug Console : Portrait view Configured
    2013-07-19 14:23:38.583 111[582:c07] -[UISwipeGestureRecognizer tag]: unrecognized selector sent to instance 0x7579dc0
    2013-07-19 14:23:38.585 111[582:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UISwipeGestureRecognizer tag]: unrecognized selector sent to instance 0x7579dc0'
    *** First throw call stack:
    (0x1ca6012 0x10e3e7e 0x1d314bd 0x1c95bbc 0x1c9594e 0xa2d9 0xb606 0xa00b 0x259e 0x1091c7 0x109232 0x583d5 0x5876f 0x58905 0x61917 0x21bb 0x25157 0x25747 0x2694b 0x37cb5 0x38beb 0x2a698 0x1c01df9 0x1c01ad0 0x1c1bbf5 0x1c1b962 0x1c4cbb6 0x1c4bf44 0x1c4be1b 0x2617a 0x27ffc 0x1dfd 0x1d25 0x1)
    libc++abi.dylib: terminate called throwing an exception

    ReplyDelete
  20. It does not work well with UIImageView :(

    ReplyDelete
  21. Please help with bug [GPOrientation handleOrientation:]. Sometime crack app. Please help me...

    ReplyDelete
  22. what is the use of didChangeUIForOrientation.
    Can you give me an example with explanation.

    ReplyDelete
  23. It is not working whenever i am using scrollview in the view

    ReplyDelete
  24. Mohammed Naveed Shaikh11 December 2013 18:00

    Not working for landscape mode…facing the same problem as@ deepjyoti, gautam, and vijay….i am surprised as to why nobody gave the solution for the same…kindly reply asap///this is on urgent basis…thank you..

    ReplyDelete