1
我有一個景觀應用程序,我想旋轉180度,如果設備翻轉。然而,在我的主視圖控制器中,shouldAutorotateToInterfaceOrientation根本沒有被調用。爲什麼會這樣?shouldAutorotateToInterfaceOrientation沒有被調用
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
NSLog(@"ROTATE? %d", interfaceOrientation); //this never gets logged
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
編輯:在應用程序的委託:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[window addSubview:topViewController.view];
[window makeKeyAndVisible];
}
您是否在窗口中添加了多個控制器視圖? 請參閱:http://developer.apple.com/library/ios/#qa/qa1688/_index.html (技術問答QA1688 爲什麼我的UIViewController不能隨設備一起旋轉?) – Krumelur 2011-03-26 00:12:44
不,我將編輯顯示應用程序委託的帖子。 – sol 2011-03-26 00:20:34
您是否編輯過Info.plist文件以顯示它支持這兩種方向? – ughoavgfhw 2011-03-26 01:34:35