选项卡内的多视图导航控制器
所以我试图制作一个带有 3 个选项卡的应用程序,其中一个选项卡有一个导航控制器。我已经成功制作了 3 个选项卡,并将其中一个选项卡变成了导航控制器。我现在陷入困境的部分是尝试向导航控制器选项卡添加其他视图。 示例:单击视图 1 上的按钮 1,它会转到视图 2,单击视图 2 上的按钮,它会转到视图 3,等等。
我是否应该为我想要的每个额外视图创建一个新的 .xib 文件,或者是否存在一种将所有视图包含在一个 .xib 文件中的方法?
请记住,我最终会有超过 20-30 种不同的观点。
另外,我对此非常陌生,大约一周后,所以尽可能多的细节将不胜感激。
谢谢。
So I'm trying to make an app with 3 tabs and one of the tabs has a navigation controller. I have succeeded in making the 3 tabs, and also turning one of them into a navigation controller. The part where I'm now stuck is trying to add additional views to the navigation controller tab.
Example: Click button 1 on view 1 and it goes to view 2, click button on view 2 and it goes to view 3, etc.
Am I supposed to make a new .xib file for every extra view that I want, or is there a way to do it with having all the views contained in one .xib file?
Keep in mind, I will have upwards of 20-30 different views in the end.
Also, I am EXTREMELY new to this, as in about a week, so as much detail as possible would be much appreciated.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该为每个视图使用单独的 xib 文件,一个 xib 中存在多个视图显然不是一种好的做法。但如果您愿意,您可以通过编程方式创建视图。
抱歉,如果这不是很有帮助,如果您进一步概述您的程序,看看是否确实需要如此多的视图,或者您是否可以为其中一些视图使用动态模板,这可能会有所帮助。
You should use a seperate xib file for each View, more than one view in a xib is afaik not good practice. But you can create your views programatically if you wish.
Sorry if this isn't very helpful, it might help if you'd outline your program a little further, to see if there was actually need for such an amount of Views or if you could use a dynamic template for some of them.
与 Gauloise 相呼应,您应该为应用中的每个屏幕都有一个
UIViewController
子类 + XIB 对。如果您愿意,可以省略 XIB 并以编程方式构建视图。然而,如果您是 iPhone 开发的新手,我建议您首先处理一个不太复杂的项目和/或完成 Apple 的一些示例项目。
Echoing Gauloises, you should have one
UIViewController
subclass + XIB pair for every screen in your app. You can omit the XIB and build the view programmatically if you wish.However, if you're brand new to iPhone development, I suggest you tackle a slightly less complex project first and/or work through some of the example projects from Apple.