UINavigationController,只是分配然后推送?
我不确定这是如何运作的。对于 nav ctlrs,我是否只需分配/初始化/自动释放我想要的视图控制器,然后将其推入堆栈?它似乎有效,我只是不知道是否还有更多内容,因为我看到了其他代码,其中 ppl 为导航 ctlr 设置了视图控制器的 NSArray,而且我不知道是否需要这样做或做什么这种方法反而给我带来了。谢谢!
I'm not sure how this works. For nav ctlrs, do I just alloc/init/ autorelease the view controller I want and then push it onto the stack? It seems to work, I just didn't know if there was more to it since I've seen other code where ppl set an NSArray of view controllers for the nav ctlr and I didn't know if I needed to do that or what that approach brought me instead. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以只分配/初始化/自动释放和推送。效果很好。
如果您想使用一堆视图控制器来设置导航控制器,以便用户可以立即使用后退按钮,请使用
-[UINavigationController setViewControllers:]
。例如,当应用程序启动时,您可以从文件或首选项加载用户之前的状态,并使用它来设置视图控制器堆栈。You can just alloc/init/autorelease and push. That works fine.
If you want to set up your navigation controller with a stack of view controllers, so the user can immediately use the back button, you use
-[UINavigationController setViewControllers:]
. For example, when the application is launched, you might load the user's previous state from a file or preference and use that to set the stack of view controllers.