2014-03-13 52 views
0

團隊,iOS 7方向不起作用

我的應用程序沒有響應iOS 7以上的方向。我試圖通過推動pushViewController屏幕,再後來我改成presentViewController

[viewController.navigationController pushViewController:landscapeCommentScreen animated:animated];

前iOS7升級後:

[viewController.navigationController presentViewController:landscapeCommentScreen animated:YES completion:nil]; 

添加在視圖控制器下面的方法

- (NSUInteger)supportedInterfaceOrientations { 
    return UIInterfaceOrientationMaskAll; 
} 


- (BOOL) shouldAutorotate { 
    return YES; 
} 


- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { 
    return UIInterfaceOrientationLandscapeRight; 
} 

回答

1

supportedInterfaceOrientations你應該不會返回UIInterfaceOrientationMaskAll。您應該返回UIInterfaceOrientationLandscapeRight

+0

我試過了,沒有運氣先生... –

+0

@RameshSangili看看我的答案在這裏:http://stackoverflow.com/a/16022631/983912完整的示例項目,正是你所需要的。 –

+0

我試過了,它不起作用。我正在構建一個框架頂部的UI屏幕,我不確定是否限制了定位支持。有沒有辦法覆蓋框架中的代碼來支持方向更改?我做了一個示例應用程序,它的工作正常。 –