Post

Replies

Boosts

Views

Activity

Reply to In the iOS16 system,interfaceOrientation、[UIScreen mainScreen].bounds,keyWindow.bounds exception
I also have this problem, when I use SEL selUpdateSupportedMethod = NSSelectorFromString(@"setNeedsUpdateOfSupportedInterfaceOrientations"); if ([nav respondsToSelector:selUpdateSupportedMethod]) { (((void (*)(id, SEL))[nav methodForSelector:selUpdateSupportedMethod])(nav, selUpdateSupportedMethod)); } if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) { SEL selector = NSSelectorFromString(@"setOrientation:"); NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDevice instanceMethodSignatureForSelector:selector]]; [invocation setSelector:selector]; [invocation setTarget:[UIDevice currentDevice]]; NSInteger val = orientation; [invocation setArgument:&val atIndex:2]; [invocation invoke]; } to rotate the screen to landscape and then use this code to rotate back to portrait. My UIScreen.main.bounds.size is still the size of the landscape screen, and UIDeviceOrientation(rawValue: 1) ---- UIInterfaceOrientation(rawValue: 3). Xcode 13.2. iOS 16 beta7.
Aug ’22