我的 View 包含 UITableViewController
,其中有 UITextFields
,可以在其中输入一些文本。当键盘出现/消失时,我调整 UITableView
高度。它很好用。
现在我有 UIAlertView
和 UITextField
。用户在 UIAlertView
的 UITextField
中输入文本,当按下“Ok”时,我会推送另一个 UIViewController
。问题是,当我回过头来看,一切都搞砸了。原因是 KeyboardWillHide
通知永远不会被触发,因此 tableView 的高度是应用程序框架高度 - 键盘高度。
有什么修复建议吗?我在 - (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
中调用了 [resignFirstResponder]
但没有帮助。我什至强行调用 KeyboardWillHide
但这也没有帮助。
有什么建议吗?
最佳答案
我在viewWillDisappear中调用removerObserver。 viewWillDisappear 在 KeyboardWillHide 被调用之前被调用。 解决方案是将removeObserver移至viewDidDisappear。这就成功了。
关于ios - 如何在导航 Controller 中推送 UIViewController 之前关闭键盘,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11260132/