2014-02-06 70 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

相關問題