我知道:默認情況下,應用程序和視圖控制器的支持的接口方向設置爲UI成語的UIInterfaceOrientationMaskAll和iPhone成語的UIInterfaceOrientationMaskAllButUpsideDown。所以,當我使用Single View Application模板創建一個新項目時,爲了在iPhone中執行所有方向,我在ViewController.m中添加了兩個方法。它的工作!我如何處理iPhone iOS6中的UINavigationController的UIInterfaceOrientationPortraitUpsideDown
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskAll;
}
- (BOOL)shouldAutorotate
{
return YES;
}
然後我改變了一些碼方法下面AppDelegate.m到應用程序的根視圖從UIViewController中改變的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;
}
在此之後,我不能處理在iPhone iOS6的所述UIInterfaceOrientationPortraitUpsideDown模擬器。我該如何解決這個問題?我試圖在舊主題中搜索一些代碼,但它仍然不起作用。
[ios 6中的方向問題]的可能重複(http://stackoverflow.com/questions/13023936/orientation-issue-in-ios-6) – Vishal 2013-04-28 02:01:19