iPhone OS 3.2 (iPad) 模态视图问题

发布于 2024-08-27 18:55:55 字数 312 浏览 3 评论 0原文

我将 UIViewController 作为模态视图控制器呈现,其中 modalPresentationStyle = UIModalPresentationFormSheet。我的视图上有几个 UITextFields。

我的问题是,当我尝试关闭键盘([textfieldname resignFirstResponder])时,它不会执行任何操作。但是,当我将 modalPresentationStyle 更改为 UIModalPresentationPageSheet 时,它就可以工作。

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

I am presenting a UIViewController as a modal viewcontroller with modalPresentationStyle = UIModalPresentationFormSheet. I have few UITextFields on its view.

My issue is that when I try to dismiss the keyboard ([textfieldname resignFirstResponder]), it doesn't do anything. However when I change the modalPresentationStyle to UIModalPresentationPageSheet, it works.

This seems to be a bug. Has any one faced similar problems and found a work around? Could I be doing anything dumb and silly?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱你不解释 2024-09-03 18:55:55

我在 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 中肯定需要它。

I ran into this same issue with UITextView, I ended up subclassing UITextView and overriding resignFirstResponder as follows...

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

I haven't checked if this is still necessary in 4.3 but it was definitely needed in 3.2 in some cases.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文