0

在我的项目设置中,我将支持的界面方向设置为两个横向。

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

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

2 回答 2

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

希望这会有所帮助。

于 2013-03-26T05:20:02.140 回答
0

是更好的实现,如果你在 info.plist 中实现它会更好

对于 ios>6

- (BOOL) shouldAutorotate
{
    return YES;
}

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}
于 2013-03-26T05:14:58.707 回答