问题
In ios 11 a new feature is introduced: Password Autofill for app. This feature allows users to use their saved password in their apps directly from the keyboard quicktype bar.
https://techcrunch.com/2017/06/08/ios-11s-new-password-autofill-for-apps-wont-work-with-or-replace-your-favorite-password-manager/
https://code.tutsplus.com/articles/faster-logins-with-password-autofill-in-ios-11--cms-29096
https://developer.apple.com/videos/play/wwdc2017/206/
But the problem is when I use keyboardWillShow or keyboardWillHide or keyboardDidShow or keyboardDidHide events none of them consider the quickbar height for keyboardSize.
- (void)keyboardWillShow:(NSNotification *)notification {
NSDictionary* info = [notification userInfo];
CGSize keyboardSize = [info[UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
}
keyboardSize would be the previous keyboardSize so if we had the quickbar and now it is disappeared it keyboardSize is more than it should be and vice versa. It seems that keyboardWillShow notification fires before the quickbar show/hide.
If anybody has any idea how to fire keyboard notifications after quickbar show/hide or any other suggestion, please share.
Thanks..
回答1:
try to useUIKeyboardFrameEndUserInfoKey
dont UIKeyboardFrameBeginUserInfoKey
回答2:
I think you're using the wrong key
try UIKeyboardFrameEndUserInfoKey
Objective c
CGSize keyboardSize = [info[UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
Swift
let keyboardSize = (info[UIKeyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
来源:https://stackoverflow.com/questions/45569276/password-autofill-quicktype-bar-in-ios-11