Thử nghiệm ứng dụng của tôi trên iOS 11 beta 7 - có vẻ như bàn phím không đẩy nội dung lên nếu UIViewController của tôi.UIKeyboardWillShowNotification issues with ios 11 beta 7
Mã này trông như thế này (làm việc kể từ iOS7):
- (void)handleNotification:(NSNotification*)notification {
if (notification.name == UIKeyboardWillShowNotification) {
CGSize keyboardSize = [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
nextButtonALBottomDistance.constant = keyboardSize.height + initialPhoneBottomDistance;
codeBottomViewALBottomDistance.constant = keyboardSize.height + initialCodeBottomDistance;
double animationDuration = [[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue];
[UIView animateWithDuration:animationDuration animations:^{
[self.view layoutIfNeeded];
}];
}
else if (notification.name == UIKeyboardWillHideNotification) {
nextButtonALBottomDistance.constant = initialPhoneBottomDistance;
codeBottomViewALBottomDistance.constant = initialCodeBottomDistance;
double animationDuration = [[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue];
[UIView animateWithDuration:animationDuration animations:^{
[self.view layoutIfNeeded];
}];
}
}
đủ Thú vị - khi tôi bấm nút home (giảm thiểu các ứng dụng) và mở lại nó (mà không giết nó) - bố cục được cố định.
Có vẻ như lỗi iOS 11 beta, nhưng tôi không thể tìm thấy bất kỳ tham chiếu nào cho đến thời điểm này.
Vui lòng biết liệu có ai đó đang gặp sự cố này không.
Thay thế 'UIKeyboardFrameBeginUserInfoKey' bằng' UIKeyboardframeenduserinfokey' –
Dường như đang hoạt động! Cảm ơn rất nhiều @AdityaSrivastava! – Gil
Rất vui được giúp bạn –