[英]Height from keyboard to navigationbar
您可以通過更改UITableView底部約束來實現。
將您的UITableView底部固定到superView。然后注冊UIKeyboardWillShowNotification
/ UIKeyboardWillHideNotification
並從NSNotification對象鍵盤框架獲取並更改底部約束常量,如下所示:
- (void)keyboardWillShow:(NSNotification *)notification {
CGRect keyboardRect = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
self.tableViewBottomConstraint.constant = CGRectGetHeight(keyboardRect);
[self.view layoutIfNeeded];
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.