景观oreintaton不适用于ios 6

时间:2012-11-05 11:35:45

标签: objective-c ios ios6 landscape

我正在开发一个iPhone应用程序,我必须将oreintation更改为landscapeleft和landscaperight。它在iPhone 4中工作但不在iPhone 5中工作。请让我知道如何为ios 6.我的代码片段使用在下面。

感谢。

3 个答案:

答案 0 :(得分:0)

添加此代码

-(NSUInteger)supportedInterfaceOrientations
{
    return (UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight);
}

它对我有用 希望它能帮到你!

修改

同时添加此代码

- (BOOL)shouldAutorotate
{
    return YES;
}

答案 1 :(得分:0)

它不像IOS6那样好用,我有同样的问题。因为他们引入了新的旋转,但运行导航控制器的旧方式(因为我的应用程序需要支持4.3)确实使它成功很难。

阅读我的问题,解决方案应该可以帮助您:

my ansswer

答案 2 :(得分:0)

试试这个

-(BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
{

    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

-(BOOL)shouldAutorotate
{

    return YES;
}

-(NSUInteger)supportedInterfaceOrientations
{

    return UIInterfaceOrientationMaskLandscapeRight;
}