2

我将 UIViewController 呈现为具有 modalPresentationStyle = UIModalPresentationFormSheet 的模态视图控制器。我的视图上几乎没有 UITextFields。

我的问题是,当我尝试关闭键盘([textfieldname resignFirstResponder])时,它什么也没做。但是,当我将 modalPresentationStyle 更改为 UIModalPresentationPageSheet 时,它可以工作。

这似乎是一个错误。有没有人遇到过类似的问题并找到了解决方法?我可以做一些愚蠢和愚蠢的事情吗?

4

1 回答 1

1

我在 UITextView 上遇到了同样的问题,我最终将 UITextView 子类化并覆盖了 resignFirstResponder,如下所示......

- (BOOL)resignFirstResponder{
    [super resignFirstResponder];
    // For some reason, UITextView doesn't like to give up first responder, ever....
    return YES;
}

我没有检查这在 4.3 中是否仍然需要,但在某些情况下在 3.2 中肯定需要它。

于 2011-04-14T16:32:29.030 回答