iPad UITextFieldDelegate 收起键盘
2011-08-03
利用 UITextFieldDelegate 收键盘是常用的事情。 但是 我调用 presentModalViewController 后, 只有 dismissModalViewController 后才能收起键盘。 今天,终于在 StackOverFlow 找到了 解决方法 原文如下: The problem was that the view where the field was display was deployed as UIModalPresentationFormSheet, change it to UIModalPresentationPageSheet fix the problem. 也就是说,ViewController 使用 UIModalPresentationFormSheet 的 Style 只有 dismissModalViewController 才能收起键盘。 示例代码:
// UIModalPresentationFormSheet 只有 dismissModalViewController 才能 收起键盘
// [ViewController setModalPresentationStyle:UIModalPresentationFormSheet];
[ViewController setModalPresentationStyle:UIModalPresentationPageSheet];
[ViewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:ViewController animated:YES];