簡體   English   中英

iPad 1顯示縱向模式而不是橫向

[英]iPad 1 showing portrait mode instead of Landscape

我在AppStore上有一個應用程序,它在iPhone上有縱向模式,在iPad上可以在橫向上運行。 然而,我得到的報告顯示它在iPad 1上顯示肖像因此破壞了整體視圖。

為什么iPad 1專門顯示人像模式? iPad的版本是5.1.1

在ios 6中,支持界面方向的方法已經改變。 為了支持兩個版本中的接口方向,我們需要檢查os版本並相應地編寫代碼。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait); 
}

支持新版本

- (NSUInteger)supportedInterfaceOrientations {

}

- (BOOL)shouldAutorotate {
   }

在我的View Controller中,我有以下內容:

- (NSUInteger)supportedInterfaceOrientations {

}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {

}

- (BOOL)shouldAutorotate {

} 

轉到並確保所有視圖控制器都返回它們支持的正確方向模式。 我在iOS 5中看到過這種行為,如果我沒記錯的話,那就是原因。

我有一個非常相似的,我通過在AppDelegate.m-> applicationDidFinishLaunching中更改以下代碼來解決它:

 [self.window addSubview:self.viewController];

 [self.window setRootViewController:self.viewController];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM