简单实现强制横屏代码

#pragma mark - 强制横屏代码
- (BOOL)shouldAutorotate
{
    //是否支持转屏
    return NO;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
    //支持哪些转屏方向
    return UIInterfaceOrientationMaskLandscape;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationLandscapeRight;
}

- (BOOL)prefersStatusBarHidden
{
    return NO;
}

有些程序我们必须强制将屏幕横屏,比如播放器一类,今天贴出简单实现横屏的代码,希望给大家带来帮助

你可能感兴趣的:(简单实现强制横屏代码)