我已经实现了正确的功能,但它们没有被触发?我在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; }
解决方法
如果要将视图控制器推送到导航控制器中的其他视图控制器堆栈,则仅需要横向将无法正常工作.您应该以模态方式显示横向约束视图控制器.
有关示例项目,请参阅此处的答案:
https://stackoverflow.com/a/16022631/983912