gpt4 book ai didi

ios - 使用 xcode11 在 ios 13 上运行项目时,基于 View Controller 的旋转停止工作

转载 作者:行者123 更新时间:2023-11-29 05:28:16 24 4
gpt4 key购买 nike

我刚刚安装了 xcode 11 gm 种子,并在其上运行我的项目,我意识到没有一个旋转方法在​​ 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;

但是 UPSideDown 旋转不会调用此方法。所以你需要注意这一点。

关于ios - 使用 xcode11 在 ios 13 上运行项目时,基于 View Controller 的旋转停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57933686/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com