如何从 ViewController 获取返回值? // popViewControllerAnimated 两次?双背?
我已经包含了 Three20 库并使用 TTNavigator 来表达我的观点。
我的目标是从视图 4 翻转回视图 2。
我找到的唯一解决方案是在视图 4 中调用 popViewControllerAnimated 以到达视图 3,然后在视图 3 的 ViewDidAppear 中再次调用 popViewControllerAnimated 以到达视图2.
问题是,当然,我只想在View 3 ViewDidAppear中调用popViewControllerAnimated,当ViewDidAppear从View 4调用到View 3时,而不是在其他情况下(例如,视图 2 打开视图 3)。
据我所知,我必须设置一个 BOOL 属性或类似的东西,但是如何设置呢? 由于 Three20 提供的 URL 导航,我无法在这里与代表一起工作。
I have included the Three20 Library and use the TTNavigator for my views.
My goal is to flip from view 4 back to view 2.
The only solution I found for this, is to call popViewControllerAnimated in View 4 to get to View 3, then in the ViewDidAppear in view 3 call the popViewControllerAnimated again, to get to View 2.
Problem is, of course, I only want to call the popViewControllerAnimated in View 3 ViewDidAppear only, when the ViewDidAppear is called from View 4 to View 3, not in other cases (e.g. View 2 opens View 3).
So as far as I see I have to set a BOOL property or something like this, but how?
I can't work with delegates here, because of the URL-Navigation given by Three20.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
UINavigationController
< /a> 的-popToViewController:animated:
方法:Use
UINavigationController
's-popToViewController:animated:
method:使用 Singleton 设计模式怎么样?
您可以在其中设置一个布尔值,您可以根据您来自哪个视图来更改该布尔值,然后在视图 3 中检查该值是什么。 情况下执行此操作的最简单方法。
在我看来,这是在不使用 delegates .h 文件的
如果代码中存在一些小错误,请原谅我,我很快就想到了。
What about using the Singleton design pattern
You can set a bool in there that you can change depending from which view you are coming and then in view 3 check what that value is. In my opinion its the easiest way of doing this without using the delegates
.h file
Forgive me if there is some small mistake in the code, did it out the top of my head real quick.