UINavigationController PushViewController - 键盘在动画上滞后
我有一个带有键盘的视图控制器(我在 viewDidLoad 方法中使用 becomFirstResponder 来实现此目的)。该视图控制器还有一个按钮,可触发 IBAction,该 IBAction 使用 PushViewController 加载另一个视图控制器。这工作正常,但我的问题是键盘似乎在第一个视图控制器中的内容之后动画消失。所以本质上当下一个视图控制器加载几秒钟然后滑出场景时它仍然存在......还有其他人遇到过这个问题吗?
I have a view controller that has a keyboard (I use becomFirstResponder in my viewDidLoad method to achieve this). This view controller also has a button which triggers an IBAction that uses pushviewcontroller to load another viewcontroller. This works fine but my problem is the keyboard seems to animate away after the content in the first view controller. So essentially it is still there when the next view controller loads for a few seconds and then slides out of the scene....Has anyone else encountered this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在您的视图控制器中,使用文本字段连接 UITextFieldDelegate ,
然后在控制器中实现它 -
因此,当您准备好推送新的视图控制器时,您只需 -
或者更简单,但放弃所有文本字段
In your view controller with the Text Fields hook up UITextFieldDelegate and do
then implement it in the controller -
So when you are ready to push your new view controller you just -
or simpler yet resign all of your text fields
您需要做的就是放弃键盘,并触发一个 NSTimer,它将调用一个方法,该方法将在固定的时间后推送到下一个视图控制器。您可以调整 NSTimer 触发的时间以获得您想要的效果。希望有帮助!
All you need to do is resign the keyboard, and fire an NSTimer which will call a method that will push to the next view controller after a fixed amount of time. You can play around with the time the NSTimer fires to get the effect you want. Hope that helps!