2014-10-29 171 views
1

我想禁用我的應用程序在iOS的8 我試圖用老方法僅旋轉一個的viewController,但它不工作或iOS的棄用8不能旋轉8

我試試這個在iOS 8中旋轉的新方法。

- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator 

但我不知道如何禁用此方法中的旋轉。我只想在這個viewController中使用橫向模式。我查了其他SO問題,但我的代碼仍然不能在iOS 8中工作。

請幫幫我。

回答

5

現在這很容易。嘗試使用:

- (BOOL)shouldAutorotate { 
    return NO; 
} 
+7

這對我不起作用。 – maxhs 2015-04-16 04:54:51

+1

試一下: - (BOOL)shouldAutorotate {YES; YES; YES; (NSUInteger)supportedInterfaceOrientations { }返回UIInterfaceOrientationMaskPortrait; } – 2015-04-24 07:09:58

+1

伊娃的答案適合我。 但更改爲 - (UIInterfaceOrientationMask)supportedInterfaceOrientations 以終止警告消息。 – willSapgreen 2016-01-06 04:50:57