为什么 presentModalViewController 会阻碍 UITextField 响应?
我添加到从另一个视图控制器使用 presentModalViewController:animated:
呈现的视图的任何 uitextfield 都不会响应任何触摸事件(例如点击 uitextfield 时键盘不会显示),如果我使用 < code>[textField成为FirstResponder]强制键盘显示,唯一有效的时候是在视图控制器的viewDidLoad
方法中
任何人都知道为什么uitextfield在我使用时没有响应presentModalViewController:animated:
显示 uitextfield 所在的视图控制器?
Any uitextfield I add to a view which is presented from another view controller with presentModalViewController:animated:
does not respond to any touch events (like the keyboard doesnt display when the uitextfield is tapped) also if i use [textField becomeFirstResponder]
to force the keyboard to display, the only time this works is in the viewDidLoad
method of the view controller
Anyone know why the uitextfield is not responsive whatsoever when i use presentModalViewController:animated:
to display the view controller which the uitextfield is on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这个问答很旧,但我刚刚注意到以模态方式呈现的
UIWebView
(带有输入字段)的相同行为,并找到了一个解决方法来保留如果此方法被删除或
返回 NO< /code>,键盘显示正确(如 DotSlashSlash 所指出的),但将其放在
前面会获得相同的结果
This Q&A is old, but I have just noticed the same behaviour with a
UIWebView
(with input fields) presented modally and found a workaround to preserveIf this method is removed or
return NO
, the keyboard shows up correctly (as pointed out by DotSlashSlash), but the same result is obtained puttingjust before
经过很多麻烦,我发现它
隐藏在我的代码中的某个地方,由于某种原因,如果我通过 PresentModalViewController:animated: 方法添加视图,则不允许文本字段成为第一响应者
after much trouble i came to find that
was hidden in my code somewhere, this for some reason was not allow the textfield to become first responder if i added the view via the
presentModalViewController:animated:
method