How can I define the iPadRotation interface at the beginning?

I am having problems with the application of my iPad application to discover its interface. Orientation in the first initialized UIViewController I (in code). In fact, if I track for application.statusBarOrientation, this also returns 1 (UIInterfaceOrientationPortrait), even if I run in landscape.

If I track self.interfaceOrientation in my first UIViewController, it stays 1 until it gets viewWillDisappear ... Unfortunately, it's too late!

Here is some code (although not much):

In my appDelegate app, I have the following:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // show loading screen first [window addSubview:loadingScreenViewController.view]; [window makeKeyAndVisible]; NSLog(@"applicationDidBecomeActive:statusBarOrientation = %d", application.statusBarOrientation); return YES; } 

which tracks 1 (portrait), although I can clearly see that the status bar is a landscape ... and in the first view controller, I have this:

 - (void)viewDidLoad { [super viewDidLoad]; NSLog(@"self.interfaceOrientation = %d", self.interfaceOrientation); } 

which also tracks 1, even in landscape mode.

Any ideas? Standing here!

Thanks:)

: - Joe

+6
objective-c ipad statusbar uiinterfaceorientation viewdidload
source share
2 answers

Here is the answer ... Several: (from the Apple Dev Forums): .... "The application always loads as if the device was a portrait, and then, if the device is really landscape, the application reports that the device is rotated. This is done to so that the tips and code should create their interface in the same orientation. you may need to have two interface layouts for each tip "..... this is not the answer I liked, but the way iOS works, unfortunately!

+2
source share

What does the application delegate in applicationDidFinishLaunching say? Because if it reports the correct value, you can always access the delegate to check the orientation.

0
source share

All Articles