IOS强制转屏

CGFloat duration = [UIApplication sharedApplication].statusBarOrientationAnimationDuration;
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:duration];
        
        [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];
        self.navigationController.view.transform = CGAffineTransformIdentity;
        self.navigationController.view.transform = CGAffineTransformMakeRotation(M_PI / 2);
        self.navigationController.view.bounds = CGRectMake(0, 0, kHorizontalWidth, kHorizontalHeight);
        
        [UIView commitAnimations];

你可能感兴趣的:(ios)