Xcode Version 12.4 (12D4e)
MacOS 11.2.3 (20D91)
iPhoneX (iOS 14.4.2)
Code Block objc self.passwordTextField.secureTextEntry = YES;
Select the auto-filled password in the "passwordTextField"(ActionSheet)
After logging in successfully, I found that the height of all NSTextFields in the app is incorrect when the keyboard is switched.
I use "UIKeyboardWillShowNotification" notification to listen for keyboard events
I use UIKeyboardFrameEndUserInfoKey to get the size of the keyboard
If you do not use secureTextEntry, the above problems will not occur
Code Block objc + (void)load { Method originAddObserverMethod = class_getInstanceMethod(self, @selector(presentViewController:animated:completion:)); Method swizzledAddObserverMethod = class_getInstanceMethod(self, @selector(xp_presentViewController:animated:completion:)); method_exchangeImplementations(originAddObserverMethod, swizzledAddObserverMethod); }
I found the code that caused the bug!
This is because it is compatible with iOS13!
Code Block objc viewControllerToPresent.modalPresentationStyle = UIModalPresentationFullScreen;