Force landscape for one view controller ios

后端 未结 3 1441
粉色の甜心
粉色の甜心 2020-12-11 16:24

I\'ve looked at several answers to questions similar but none of the answer worked. I have an app where I need everything portait except for one photo viewer I have. In th

3条回答
  •  庸人自扰
    2020-12-11 17:05

    Lets try this code:

        [UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight;
    self.navigationController.view.center = CGPointMake(([UIScreen mainScreen].bounds.size.width/2), [UIScreen mainScreen].bounds.size.height/2);
    CGFloat angle = 90 * M_PI / 180;
    self.navigationController.view.transform = CGAffineTransformMakeRotation(angle);
    self.navigationController.view.bounds = CGRectMake(0, 0,[UIScreen mainScreen].bounds.size.height , [UIScreen mainScreen].bounds.size.width);
    

提交回复
热议问题