[英]Landscape Apps Xcode 5 / iOS 7
我在App Store中有一個鋼琴應用程序。 它在橫向模式下工作。
現在,iOS 7似乎正在忽略IB中的“風景”設置
該應用程序可以在iOS 6及更低版本的橫向環境中正常工作。 在iOS 7中以縱向顯示。 以下是設置和相關代碼:
//iOS 6+
- (BOOL)shouldAutorotate
{
return YES;
}
//iOS 6+
- (NSUInteger)supportedInterfaceOrientations
{
return (UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight);
}
//iOS 5.1.1-
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
感謝@shawnwall評論,我意識到我沒有Root View Controller。 過去,我的應用支持iOS 3.1.3 O_O:
[self.window addSubview:self.viewController.view];
我很久以前就放棄了3.1.3支持,因此可以設置一個根視圖控制器:
self.window.rootViewController = self.viewController;
那是導致視覺錯誤的原因。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.