viewDidAppear & viewWillAppear 未在选项卡栏应用程序中触发
在选项卡栏应用程序中,我通过执行以下操作向第一个选项卡栏视图添加视图:
[self.view addSubview:anotherView.view];
一旦 anotherView 完成,我会执行:
[self.view removeFromSuperview];
返回到父级,但不会在父级上触发 viewDidAppear 或 viewWillAppear。我可以使用消息传递,但似乎必须有更好的方法。有什么建议吗?
In a tab bar application, I'm adding a view to my first tabbar view by doing:
[self.view addSubview:anotherView.view];
Once anotherView is done, I do:
[self.view removeFromSuperview];
Which goes back to the parent but doesn't fire viewDidAppear or viewWillAppear on the parent. I can use messaging but it seems there must be a better way. Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您将子视图添加到第一个视图时,它仍然可见,就在第二个视图的后面。这些方法不会触发,因为技术上它始终可见,即使它完全被第二个视图覆盖。
When you add a subview to the first view, it's still visible, just behind the second view. Those methods don't fire because technically it's visible the whole time, even if it's completely covered by the second view.