iPhone:推动视图控制器导致键盘动画缓慢且不稳定
我有一个模型-视图-控制器设计应用程序,包含 20 多个视图和图像视图。
在一个视图中,我有一个文本字段,当视图显示时,该文本字段被设置为第一响应者,以便键盘立即可见。当我将此视图推到导航控制器上时,键盘的显示非常缓慢且不稳定。然而,当我弹出视图时,键盘的缩回快速且平滑。
推动视图时动画缓慢且不稳定的原因是什么?当视图加载时,我确实必须让键盘可见。
I have a model-view-controller design app with more than 20 views and imageviews.
In one view, I have a textfield that gets set to first responder when the view displays such that the keyboard is immediately visible. When I push this view onto the navigation controller the display of the keyboard is very slow and jerky. However, when I pop the view, the retraction of the keyboard is fast and smooth.
What could cause the slow and jerky animation when pushing the view? I really have to have the keyboard visible when the view loads.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题是,您分配了如此多的不同视图控制器,例如 [[MyViewController alloc] init...] ,以至于您的测试平台专注于管理与应用程序关联的内存。基本上,通俗地说,您的 iPhone 没有足够的处理能力来执行流畅的动画并处理您打开的所有视图。
您可以执行以下两种操作之一:
1.) 在打开新视图控制器时释放视图控制器对象。
2.)既然你说你有很多 UIImageViews,而不是每次你想要执行转换时分配一个全新的视图控制器,重新加载类数据,然后推送、呈现或弹出到你的视图控制器对象。例如。 [[self navigationController] PresentModelViewController:self];
Your problem is that you have so many different view controllers allocated e.g [[MyViewController alloc] init...] that your test platform is pre-occupied with managing the memory associated with your application. Basically, in Layman's terms, your iPhone doesn't have enough processing power to perform a smooth animation and handle all the views you have open.
You can do one of two things:
1.) Release your view controller objects when opening a new view controller.
2.) Since you said you have a lot of UIImageViews, instead of allocating an entirely new view controller each time you want to perform a transition reload the class data and then push, present, or pop to your view controller object. eg. [[self navigationController] presentModelViewController:self];