2014-02-06 71 views
3

我已经实现了正确的功能,但它们不会被触发?我在StackOverFlow上尝试了几个解决方案,但都没有工作。我已经尝试将视图添加到UINavigationController,也不起作用。强制UIViewController处于横向模式iOS7

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; 
} 
+0

您尝试过哪些SO解决方案?正如你所说,有几个...我宁愿不通过它们全部列出。 – nhgrif

+0

可能的重复:http://stackoverflow.com/questions/19095161/force-landscape-ios-7 –

+0

可能的重复[在iOS6中,麻烦强制ViewController某些interfaceOrientation推入堆栈时](http:// stackoverflow。 com/questions/15300819/in-ios6-trouble-forcing-viewcontroller-to-certain-interfaceorientation-when-pus) – matt

回答

4

如果正在推动一个视图控制器在导航控制器的其它视图控制器的堆叠,需要仅景观不会工作得很好。您应该以模态方式显示风景约束视图控制器。

见我的答案这里的一个例子项目: https://stackoverflow.com/a/16022631/983912

相关问题