objective-c – 强制UIViewController处于横向模式iOS7
发布时间:2020-12-14 17:12:39 所属栏目:百科 来源:网络整理
导读:我已经实现了正确的功能,但它们没有被触发?我在StackOverFlow上尝试了几种解决方案,但它们都不起作用.我已经尝试将视图添加到UINavigationController,也不起作用. FakeIDDetailViewController.h: @interface FakeIDDetailViewController : UIViewControlle
我已经实现了正确的功能,但它们没有被触发?我在StackOverFlow上尝试了几种解决方案,但它们都不起作用.我已经尝试将视图添加到UINavigationController,也不起作用.
FakeIDDetailViewController.h: @interface FakeIDDetailViewController : UIViewController @end FakeIDDetailViewController.m: @interface FakeIDDetailViewController () -(BOOL)shouldAutorotate { return NO; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (UIInterfaceOrientationMaskLandscapeLeft); } -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscapeLeft; } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationLandscapeLeft; } - (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { return UIInterfaceOrientationLandscapeLeft; } 解决方法
如果要将视图控制器推送到导航控制器中的其他视图控制器堆栈,则仅需要横向将无法正常工作.您应该以模态方式显示横向约束视图控制器.
有关示例项目,请参阅此处的答案: (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |