2013-03-26 59 views
0

在我的项目设置中,我将支持的接口方向作为两个横向。支持的接口方向和shouldAutorotateToInterfaceOrientation

我还应该在每个视图控制器下面实现吗?

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return UIInterfaceOrientationIsLandscape(interfaceOrientation); 
} 
+1

如果你想在iOS 6中支持ios <6 – 2013-03-26 05:14:15

+0

,那么这些方法不同于其他任何东西 – Kasaname 2013-03-26 05:15:25

+0

@j_mcnally,所以只需在应用程序设置中指定是不够的 Saran 2013-03-26 05:35:32

回答

3

的iOS < 6.x的这将是更好

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation // Deprecated in iOS 6.x 
{ 
    return UIInterfaceOrientationIsLandscape(interfaceOrientation); 
} 

iOS> 6.x

- (BOOL) shouldAutorotate 
{ 
    return YES; 
} 

-(NSUInteger)supportedInterfaceOrientations 
{ 
    return UIInterfaceOrientationMaskLandscape; 
} 

希望这会有所帮助。

0

雅它能够更好地实现,如果你的方向中实现它的Info.plist景观

为iOS> 6

- (BOOL) shouldAutorotate 
{ 
    return YES; 
} 

-(NSUInteger)supportedInterfaceOrientations 
{ 
    return UIInterfaceOrientationMaskLandscape; 
}