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

code.warrior

macrumors newbie
Original poster
Feb 6, 2009
14
0
Hi,

Kindly help me in this regard. In my application, I'm developing two different view controllers, one for portrait mode and one for landscape mode, when the device will be rotated.
So I want the portrait view controller to load when the device is in portrait mode and it should load landscape view controller when device is rotated to landscape mode.
I'm using 'UIWindow' to manage these view controllers.

How shall I achieve this?


Thanks for reading through.
 

code.warrior

macrumors newbie
Original poster
Feb 6, 2009
14
0
oh, anyways, well I found out the way.
For the future purpose, if anyone( like me ) needs this, then here is the solution. Use the one of the following methods, according to the need of the application, in your application delegate:

Code:
-(void) application:willChangeStatusBarOrientation:duration:
Or
-(void) application:didChangeStatusBarOrientation:
And in those methods, set the appropriate view controller as the subview of the main application view, according to the orientation of the device.
That's all.


Thanks
 

jnic

macrumors 6502a
Oct 24, 2008
567
0
Cambridge
Hi,

Kindly help me in this regard. In my application, I'm developing two different view controllers, one for portrait mode and one for landscape mode, when the device will be rotated.
So I want the portrait view controller to load when the device is in portrait mode and it should load landscape view controller when device is rotated to landscape mode.
I'm using 'UIWindow' to manage these view controllers.

How shall I achieve this?


Thanks for reading through.

Add some logic to the shouldAutorotateToInterfaceOrientation: method in your UIViewController.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.