Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sagarshivam

macrumors member
Original poster
May 24, 2011
51
0
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
Code:
[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
 
Last edited by a moderator:
Err, if you use the standard code, it should rotate by itself.

Code:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
	return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

But i'm not 100% sure how to tackle what you want, i know there is a delegate method like, "willrotate" or something, where you can load the stuff you want depending on orientation, but i would not do that. Just create your own methods, and place the stuff where you need it when the rotate will hapen
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.