Results 1 to 2 of 2
  1. #1

    Member Since
    Jun 03, 2011
    Loading xib depending on orientation of device whilelaunching the appliction
    Dear All

    I have created login screen using IB. And in add-info.plist , in type: "main nib base file name", I have written name of the xib which I created using IB.

    Now in application delegate's didFinishLaunchingWithOptions method, I am simply writing
    [window makeKeyAndVisible];
    return YES

    This way, the login view (login xib)is loaded as soon as I start the application.But my problem is that this is always launched in portrait mode and there is no rotation when simulator/iPad is rotated.

    My query is that If I make two xib: one for portrait mode and other for landscape mode, how is it possible to load the one depending on the device orientation.

    Also, when I open the xib in IB, in attribute inspector, orientation of xib is always seen in default portrait (in orientation field) and I am unable to change it as it is disabled.

    Any idea is appreciated.

  2. #2

    Mark FX's Avatar
    Member Since
    Aug 13, 2011
    West Sussex, UK
    I think you would be better off creating a UIViewController class, then loading the xib file from that controller class's initWithNibName:bundle: method.

    That way you can use the UIViewController class's shouldAutorotateToInterfaceOrientation: method, like this.

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)io
        return (io == UIInterfaceOrientationPortrait || UIInterfaceOrientationIsLandscape(io);
    The above implementation of the UIViewController method, will turn all views automatically
    to the correct orientation.

    Hope this helps.

    Regards Mark

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. weird purple, mirrored, shadow reflections in Xcode's xib editor
    By bane-o in forum OS X - Development and Darwin
    Replies: 0
    Last Post: 07-30-2013, 02:49 AM
  2. .xib file in a new project
    By paristotle in forum iOS Development
    Replies: 3
    Last Post: 11-19-2011, 07:09 PM
  3. Old iMac G3 slot loading desktop cd/dvd loading prob.
    By Jdzieds in forum Other Hardware and Peripherals
    Replies: 9
    Last Post: 01-10-2010, 06:10 PM
  4. Replies: 1
    Last Post: 04-20-2009, 10:07 PM
  5. Monitor Orientation
    By jdgti in forum OS X - Operating System
    Replies: 4
    Last Post: 10-04-2006, 07:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts