XCode 4.1 - XIB 内的多个视图
我已经成功创建了一个应用程序,并为其提供了一个 TabBar 视图控制器,该控制器按我的希望工作,但遇到了故障。
在从 tabBar 加载的每个 xib 上,我需要创建子视图,这些子视图将在与数据库交互时执行任务(或..将)。我已经创建了我的第一页和将导航到 XIB 内的视图的按钮,但还不知道如何在 XIB 本身的视图之间导航。
- 当按下按钮时加载单独的 XIB 会更好吗? 或者
- 我应该在 XIB 中为每个类别创建视图并在它们之间切换?
我仍在学习,并且对导航有一些困惑,因为我已经有 TabBar 控制应用程序的根目录。我一直在寻找教程,但它们似乎都以导航控制器作为根、TabBar 作为根开始,而不像我上面的选项 1 所需要的那样。
如果需要,我可以添加应用程序的详细信息,但目前正在寻求指导。
谢谢你,
银虎
I have created an application successfully and given it a TabBar view controller that is working as i had hoped, but have run into a glitch.
On each xib i load from the tabBar I need to create sub-views that will perform tasks as this interacts with a database (or .. will). I have created my first page and the buttons that will navigate to the views within the XIB, but do not yet nkow how to navigate between views within the XIB itself.
- would it be better to have seperate XIB's that load when the buttons are hit?
OR - should i create views within the XIB's for each category and switch between them?
I am still learning and have had some confusion regarding navigation as I already have the TabBar controlling the root of the application. I have been looking for tutorials, but they all seem to start at either navigation controller as the root, TabBar as the root, and nothing like I need for option 1 above.
I can add details of the app if needed, but am looking for guidance for now.
Thank you,
Silver Tiger
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要在视图之间导航,最好的方法是使用导航控制器推送/弹出单独的视图控制器,从单独的笔尖加载。 UINavigationController是UIViewController的子类,因此你可以完美地为每个选项卡放置一个导航控制器。您还可以在新的 xcode 4.2 中使用故事板,但我建议您在这样做之前先熟悉一下这一点。
To navigate between views the best way is to use a navigation controller pushing/popping separate view controllers, loaded from separate nibs. UINavigationController is a subclass of UIViewController, so you can perfectly put a navigation controller for each tab. You can also use story-boarding in the new xcode 4.2, but I recommend getting comfortable with this before doing so.