New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
iOS Development Discussion on developing apps for the iOS platform.

Loading xib depending on orientation of device whilelaunching the appliction


Post Reply New Thread Subscribe

 
Thread Tools
sagarshivam

 
Member Since: Jun 03, 2011
Posts: 54
sagarshivam is on a distinguished road

sagarshivam is offline
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.
Regards
QUOTE Thanks
Mark FX

 
Mark FX's Avatar
 
Member Since: Aug 13, 2011
Location: West Sussex, UK
Posts: 170
Mark FX has a spectacular aura about

Mark FX is offline
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.

Code:
- (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
QUOTE Thanks

Post Reply New Thread Subscribe


« UIActivityIndicator problem | Help with stringByEvaluatingJavaScriptFromString in UIWebView »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
problem with terminal walkntalk OS X - Operating System 6 08-16-2011 03:36 PM
Tablet? Gaming device? dan828 Apple Rumors and Reports 1 01-30-2006 10:14 PM

All times are GMT -4. The time now is 11:37 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?