使用 UITabBar 应用程序刷新 ViewController
我正在使用一个常见的 TabBar 应用程序,其中我有一个视图控制器来进行一些微积分,还有一个我从这些结果中绘制一些绘图。
第一次使用 ViewDidLoad 方法时效果很好。但是当我更改第一个选项卡中的值并切换选项卡时,它不会刷新。
当我再次返回图形视图控制器时,ViewWillAppear 方法似乎没有被调用。
绘图值与 sigleton 共享,目前我只能使用一个蹩脚的按钮来刷新。有谁知道如何正确触发自动刷新?
先感谢您。
I'm using a common TabBar application where I got one viewController to get some calculus and one where I make some drawings from these results.
It works quite well for the first time with the ViewDidLoad method. But It doesn't refresh the other time when I change values in the first tab and I switch tabs.
The ViewWillAppear method doesn't seem to get called when I come back again in the graph viewController.
The drawing values are shared with a sigleton and I can refresh only with a lame push button for now. Does anyone know how to trigger properly the refresh automatically ?
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ViewWillAppear 只会被调用
所以我假设您正在使用文本字段来接收来自用户的数据,是吗?如果是这样,您将需要在用户将文本“输入”到文本字段后立即刷新,方法是按 iOS 键盘上的“返回”按钮或其他方式(无论您设置的方式如何)。如果您能提供更多信息,我很乐意为您提供进一步帮助。
ViewWillAppear only gets called
So I am assuming you are using text fields to receive the data from the user, yes? If so, you will need to refresh as soon as the user "enters" the text into the text field, either by pressing the Return button on the iOS keyboard or some other means(which ever way you have set it up). If you can provide more information I would be glad to further assist you.