如何在没有导航控制器的情况下创建多个视图?
我正在尝试在 Xcode 4 中的基于视图的 iPhone 应用程序中创建多个视图。我遵循了许多教程并阅读了许多文章,但没有一个起作用。我发现他们需要一个导航控制器。如何在没有导航控制器的情况下创建通过按钮切换的 2 个视图?
谢谢!
I am trying to create multiple views in my view-based iPhone app in Xcode 4. I have followed many tutorials and read many articles but none of them have worked. I figured out that they require a Navigation Controller. How can I create 2 views that are switched with a button without a Navigation Controller?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我会使用presentModalViewController。 YouTube 上有大量关于如何切换视图的视频,其中一些视频没有presentModalViewController,因此您必须观看视频以查看他们是否在代码中编写presentModalViewController。我总是使用presentModalViewController。
I would use presentModalViewController. There are a ton of youtube videos on how to switch views, some of them don't have presentModalViewController so you have to watch the video to see if they write presentModalViewController in their code. I always use presentModalViewController.
您可以创建一个附加视图并将其保留为控制器中的保留变量,并且根据需要,您可以执行以下操作
you can create one additional view and keep it as a retained variable in your controller and on demand, you can do
为什么不使用 UINavigationController 而是禁用导航栏?
这是最简单的方法。并且它将避免由于不正确的视图控制器编程而导致的许多问题。您的用户永远不会知道其中的区别 - 没有视觉线索表明您已经这样做了。
Why not use a UINavigationController but disable the navigation bar?
It's the easiest way to do it. And it will avoid many issues that can come about with incorrect view controller programming. Your users will never know the difference - there are no visual clues that you've done it that way.