我有一个应用程序,它运行良好,在iOS 12和更低的预期。我只是支持我的应用程序的肖像模式。现在,在iOS 13中,如果我打开相机捕捉视频并旋转设备,摄像机就会旋转,但是当我点击“选择视频”时,我的应用程序也会显示在风景中旋转。有人知道这件事吗?
更新
每当我们解散呈现的视图控制器时,这个问题就会再次出现,但却是随机的。有人知道这件事吗?
发布于 2019-10-18 09:10:45
我通过在UIImagePickerController的委托回调中设置纵向定向来解决这个问题。这个问题只出现在我们打开相机时才直接使用视频选项。如果我们打开相机与照片和视频选项。它工作得很好。
- (void)setPortraitOrientation {
[[UIDevice currentDevice] setValue:@(UIInterfaceOrientationPortrait) forKey:@"orientation"];
[UINavigationController attemptRotationToDeviceOrientation];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
[self setPortraitOrientation];
[picker dismissViewControllerAnimated:YES completion:NULL];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[self setPortraitOrientation];
[picker dismissViewControllerAnimated:YES completion:^{
}];
}https://stackoverflow.com/questions/58414192
复制相似问题