简体   繁体   English

iOS7不支持横向方向

[英]Landscape orientation is not supported in ios7

I want to make a screen in landscape mode only. 我只想在横向模式下制作屏幕。 It is work fine unto ios5. 到ios5正常工作。 But in iOS 7 it is not working. 但是在iOS 7中,它不起作用。 I used following code to give support in ios7. 我使用以下代码在ios7中提供支持。

-(BOOL)shouldAutorotate{return TRUE;}
-(NSUInteger)supportedInterfaceOrientations{return UIInterfaceOrientationMaskLandscape;}

It won't get call for all screens. 不会在所有屏幕上都收到呼叫。 Thanks. 谢谢。 AKS. AKS。

- (BOOL)shouldAutorotate
{
    UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];

    if (orientation==UIDeviceOrientationLandscapeRight || orientation==UIDeviceOrientationLandscapeLeft) {

        return YES;
    }
    return NO;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}

If anyone else is having this issue, I wrote a blog post about it. 如果其他人是否有这个问题,我写了一篇博客文章了。 I was having a lot of trouble with this too. 我对此也有很多麻烦。 http://www.jmeveryday.com/ios7-device-orientation/ http://www.jmeveryday.com/ios7-device-orientation/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM