iOS 13横屏问题的解决

苹果对于横屏问题开放的接口很少,甚至在iOS13中已经禁止一切横屏操作,此时我们应该怎么做,那就是旋转屏幕,给用户一个横屏的假象,至于旋转之后的状态栏问题,我已经观察过了,优酷爱奇艺等视频网站的状态栏都是自定义加上去的,这个对于我们不难  下面是横屏铺满屏幕的代码

/// Gets the rotation Angle of the transformation.

- (CGAffineTransform)getTransformRotationAngle:(UIInterfaceOrientation)orientation {

    if (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation) && orientation == UIInterfaceOrientationPortrait) {

        return CGAffineTransformIdentity;

    }

    if (orientation == UIInterfaceOrientationPortrait) {

        return CGAffineTransformIdentity;

    }else if (orientation == UIInterfaceOrientationLandscapeLeft){

        return CGAffineTransformMakeRotation(-M_PI_2);

    }else if(orientation == UIInterfaceOrientationLandscapeRight){

        return CGAffineTransformMakeRotation(M_PI_2);

    }

    return CGAffineTransformIdentity;

}


调用的时候直接self.view.transform = [self getTransformRotationAngle:UIInterfaceOrientationLandscapeRight];


不要相信网上的那些骚操作  哪个成功了发我链接我试试

你可能感兴趣的:(iOS 13横屏问题的解决)