什么方法用于识别用户何时在选项卡视图控制器中切换视图
我正在开发我的第一个简单的选项卡视图控制器应用程序。第一个选项卡是设置选项卡,我刚刚让测试人员提供了一个意外的用例。为了解决这个用例,我需要在用户离开视图时和加载下一个视图之前执行。在下一个视图中运行代码为时已晚。
当用户选择 TabView 控制器来切换视图时,从当前 viewController 调用什么方法?
我尝试使用 viewWillDisappear 作为执行代码的点,但是切换视图时似乎不会调用它。
I am working on my first simple tabview controller app. The first tab is a setup tab, and I just had a tester provide an unexpected use case. In order to address this use case, I need to execute when the user is leaving the view and before I load the next one. Running code in the next view is too late.
What method is called from the current viewController at the point the user selects the TabView Controller to switch views?
I've tried using viewWillDisappear as the point to execute my code, but this does not appear to be called when switching views.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,必须重构代码以消除依赖关系。已决定存储每个屏幕元素的状态,然后在需要时在辅助视图上访问它。
OK, had to restructure the code to remove the dependency. Have decided to store the state of each screen element and then access it when needed on the secondary view.