如何重置选项卡栏中视图的状态?
这是一个相当简单的问题,尽管我的谷歌搜索没有给我任何结果。
如何以编程方式重置位于选项卡栏中的视图层次结构的状态?我想要复制的行为是当用户点击选项卡两次时。这会导致该选项卡下的视图返回到其初始状态。
该选项卡由 UINavigationController “拥有”,当用户到达视图层次结构中的某个点时,我想将此行为连接到一个按钮。
除了调用 AppDelegate 中的一个方法来杀死视图并将其再次添加回 UITabBarController 之外,我的所有尝试都失败了。但这感觉不是正确的做法。
提前致谢。
此致 //Abeansits
This is a fairly straightforward question though my Googling session gave me nothing.
How do I reset the state of a view hierarchy located in a tabbar programmatically? The behavior I want to replicate is when the user tapps on a tab twice. This causes the view located under that tab to return to it's initial state.
The tab is "owned" by a UINavigationController
and when the user reaches a certain point in the view hierarchy there is a button which I want to connect this behavior to.
All my attempts have failed except calling on a method in AppDelegate which kills the view and adds it back to the UITabBarController
again. But this does not feel like the right way to go.
Thanks in advance.
Best regards
//Abeansits
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定我是否正确理解了这个问题,但我认为你应该看看
http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UINavigationController_Class/Reference/Reference.html#//apple_ref /occ/instm/UINavigationController/popToRootViewControllerAnimated:
I am not sure if I understand the question correctly but I think you should look at
http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UINavigationController_Class/Reference/Reference.html#//apple_ref/occ/instm/UINavigationController/popToRootViewControllerAnimated: