2012-10-31 53 views
1

正如標題所描述的,我在應用程序atm中的方向有一個大問題。看來我無法控制不同幻燈片中的方向。下面的事,我是嘗試和我的應用程序的工作/不工作:IOS設置方向不起作用

  • 的Xcode拒絕聽取任何幻燈片在shouldAutorotateToInterfaceOrientation方法給出任何代碼。

  • Xcode拒絕聽每張幻燈片在stoaryboad中給出的任何設置。

  • Xcode監聽info-plist文件,但是從此文件中只能設置應用中所有視圖/幻燈片的方向。我想要一些幻燈片只允許橫向模式和其他肖像模式。

我曾嘗試刪除所有UINavigationBars/Tabbars在我的應用程序和actualy只使用1個單視圖控制器作爲初始視圖控制器和仍然存在的問題,只能從管理信息-plist文件的方向。基本上,應用程序會重新偵聽除info-plist文件之外的任何其他信息,以調整方向設置?

我盡力瞭解這個問題,但我不能說我已經獲得了更大的「啊哈片刻」至今,因爲蘋果提供的所有可能的方式來調整設置,簡直不適用於我的應用程序atleast,偉大的蘋果! ....我們之前有沒有經歷過這個或者聽說過這個問題的人?

回答

2

- (BOOL)shouldAutorotateToInterfaceOrientation:在IOS 6

已經過時,你應該重寫你的UIViewController子類的- (NSUInteger)supportedInterfaceOrientations方法。

例子:

- (NSUInteger)supportedInterfaceOrientations 
{ 
    return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft; 
} 

編輯:

如果您使用一個UINavigationController,你必須繼承的是爲好,並實現上述邏輯。這是預期的功能。相關的StackOverflow Q/A:

iOS 6 bug: supportedInterfaceOrientations not called when nav controller used as window root

iOS 6 rotations: supportedInterfaceOrientations doesn´t work?

Set different supportedInterfaceOrientations for different UIViewControllers

+0

- (NSUInteger)supportedInterfaceOrientations { 返回UIInterfaceOrientationMaskPortrait; }沒有工作,即使使用此代碼,仍然可以使用景觀.... – user1293618

+0

您使用的是UINavigationController嗎? – hukir

+0

也只有根視圖控制器或全屏顯示的視圖控制器才能獲取這些消息。 – jackslash