I know that: By default, an app and a view controller’s supported interface orientations are set to UIInterfaceOrientationMaskAll for the iPad idiom and UIInterfaceOrientationMaskAllButUpsideDown for the iPhone idiom. So when I created a new project with Single View Application template, to perform all orientation in iPhone i add two method below to ViewController.m. And it work!
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskAll;
}
- (BOOL)shouldAutorotate
{
return YES;
}
Then i changed some codes in method below of AppDelegate.m to change the root view of application from UIViewController to UINavigationController
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil];
} else {
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil];
}
if(myNavigationController == nil)
myNavigationController = [[UINavigationController alloc]initWithRootViewController:self.viewController];
self.window.rootViewController = self.myNavigationController;
[self.window makeKeyAndVisible];
return YES;
}
After that, i can't handle the UIInterfaceOrientationPortraitUpsideDown in iPhone iOS6 simulator. How can i resolve that? I tried to search a bit of code in older topic but it still not work.