如何在iOS 6中强制UIViewController面向肖像就像ShouldAutorotateToInterfaceOrientation在IOS 6中被废弃,我使用它强制使用特定的视图只限于肖像画在iOS 6中,正确的方法是什么?这只适用于我的应用程序中的一个区域,所有其他视图都可以旋转。
3 回答
ABOUTYOU
TA贡献1812条经验 获得超5个赞
@implementation UINavigationController (Rotation_IOS6)-(BOOL)shouldAutorotate{
return [[self.viewControllers lastObject] shouldAutorotate];}-(NSUInteger)supportedInterfaceOrientations{
return [[self.viewControllers lastObject] supportedInterfaceOrientations];}- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];}@end
潇潇雨雨
TA贡献1833条经验 获得超4个赞
UIApplication* application = [UIApplication sharedApplication];if (application.statusBarOrientation != UIInterfaceOrientationPortrait){
UIViewController *c = [[UIViewController alloc]init];
[self presentModalViewController:c animated:NO];
[self dismissModalViewControllerAnimated:NO];}UIViewController
iOS 7的最新情况
UIApplication* application = [UIApplication sharedApplication];if (application.statusBarOrientation != UIInterfaceOrientationPortrait){
UIViewController *c = [[UIViewController alloc]init];
[c.view setBackgroundColor:[UIColor redColor]];
[self.navigationController presentViewController:c animated:NO completion:^{
[self.navigationController dismissViewControllerAnimated:YES completion:^{
}];
}];}- 3 回答
- 0 关注
- 573 浏览
添加回答
举报
0/150
提交
取消
