使用xcode11在ios 13上运行项目时,基于视图控制器的旋转停止工作

使用xcode11在ios 13上运行项目时,基于视图控制器的旋转停止工作,ios,objective-c,ios13,Ios,Objective C,Ios13,我刚刚安装了xcode 11 gm seed,并在其上运行了我的项目,我意识到,在xcode 10及之前的版本中,调用的旋转方法中没有一个是完美的。我不知道是xcode的错误还是我遗漏了什么。下面是我正在使用的设备旋转方法 - (BOOL) shouldAutorotate { if([videoOptions[@"doc_type"] integerValue] == 3){ return NO; } return YES; } -

我刚刚安装了xcode 11 gm seed,并在其上运行了我的项目,我意识到,在xcode 10及之前的版本中,调用的旋转方法中没有一个是完美的。我不知道是xcode的错误还是我遗漏了什么。下面是我正在使用的设备旋转方法

- (BOOL) shouldAutorotate
{

    if([videoOptions[@"doc_type"] integerValue] == 3){
                return NO;
    }
    return YES;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
       if([videoOptions[@"doc_type"] integerValue] == 3){
            return UIInterfaceOrientationPortrait;
        }
    return UIInterfaceOrientationPortrait|UIInterfaceOrientationLandscapeLeft|UIInterfaceOrientationLandscapeRight;
    //    return UIInterfaceOrientationPortrait;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
    if([videoOptions[@"doc_type"] integerValue] == 3){
        return UIInterfaceOrientationMaskPortrait;
    }
    return UIInterfaceOrientationMaskAllButUpsideDown;
    //    return UIInterfaceOrientationMaskPortrait;
}

// Notifies when rotation begins, reaches halfway point and ends.
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    //    NSLog(@"%ld, duration: %f", (long)toInterfaceOrientation, duration);
    //    [self.movieSlider hidePopover];
}

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{

    [self viewRotationCompleted];
} 
两种方法

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 
                                duration:(NSTimeInterval)duration;
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation;
从iOS8起已进行了去润滑。你需要使用他们的替换方法

- (void)viewWillTransitionToSize:(CGSize)size 
       withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator;
-(void)视图大小:(CGSize)大小
withTransitionCoordinator:(id)协调员;
但是这种方法不会被调用来进行上下旋转。所以你需要注意这一点