相关疑难解决方法(0)

在iOS 8中不推荐使用"interfaceOrientation",如何更改此方法目标C.

我从Cocoa Controls下载了一个使用此方法的simpleCamera视图

- (AVCaptureVideoOrientation)orientationForConnection
{
    AVCaptureVideoOrientation videoOrientation = AVCaptureVideoOrientationPortrait;
    switch (self.interfaceOrientation) {
        case UIInterfaceOrientationLandscapeLeft:
            videoOrientation = AVCaptureVideoOrientationLandscapeLeft;
            break;
        case UIInterfaceOrientationLandscapeRight:
            videoOrientation = AVCaptureVideoOrientationLandscapeRight;
            break;
        case UIInterfaceOrientationPortraitUpsideDown:
            videoOrientation = AVCaptureVideoOrientationPortraitUpsideDown;
            break;
        default:
            videoOrientation = AVCaptureVideoOrientationPortrait;
            break;
    }
    return videoOrientation;
}
Run Code Online (Sandbox Code Playgroud)

问题是在iOS 8中不推荐使用"interfaceOrientation"但我不知道在Switch条件中替换它的方法和方法.

cocoa-touch objective-c ios

73
推荐指数
2
解决办法
3万
查看次数

视图控制器以模态方式显示时,未在iOS 9中调用"viewWillTransitionToSize:"

我从另一个提出一个视图控制器:

- (void)showModalView
{
   UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
   MySecViewController *mySecViewController = [storyboard instantiateViewControllerWithIdentifier:@"secController"];
   mySecViewController.delegate = self;
   [self presentViewController:mySecViewController animated:YES completion:nil];
}
Run Code Online (Sandbox Code Playgroud)

然后在呈现中UIViewController,该方法viewWillTransitionToSize:withTransitionCoordinator:被调用iOS 8但不在iOS 9...

谢谢

uiviewcontroller screen-orientation autorotate ios presentviewcontroller

20
推荐指数
2
解决办法
8366
查看次数