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.
Post
Replies
Boosts
Views
Activity
A solution I found on github
https://github.com/SnowGirls/Objc-Deallocating