I am using a splitviewcontroller as the rootview of my application. I need to show the login and registration views as a modal view on top of the splitviewcontroller. When i try presenting login/reg view from the viewdidAppear method of splitViewController's rootview, it is not showing up. I tried presenting the login/reg view from the Appdelegate's didFinishLaunching method using the following code
[self.window.rootViewController presentModalViewController:self.navController animated:NO];
and it works.
My problem is, the application supports both the landscape orientations, but when i run it in the device, no matter in which orientation i hold the device, I get only LandscapeRight as orientation. So if i hold the device in LandscapeLeft orientation, app lauches with login screen upside down. I am using LandscapeLeft & Right in supported orientations on the info.plist.
Please help me resolve the issue. Also how will we present a view when we have splitViewcontroller as the rootview of the app?
In iOS 5.0 (only) I am able to present the login view from the splitviewcontroller's rootview controller - viewdidAppear method. In all other OS versions, this case is not working and i need to present it from the Appdelegate's didFinishLaunching method.
If I remember correctly, iOS misreports the actual orientation until the first rotation.
Also IIRC, using
[[UIApplication sharedApplication] statusBarOrientation]
circumvents this problem.After removing the login view from the window set the rootviewcontroller direction according to the orientation of device using following code.
It will load the Rootviewcontroller according to the device orientation.