iPhone应用程序-UINavigationController和UITabBarController的组合
我想制作具有复杂视图的登录应用程序。
需求流程如下:
Login Page --> Menu Page --> Detail Page with Tab Control. --> Navigation Page
这里的“详细信息页面”再次是两个视图的组合。导航视图和选项卡视图。
即“详细信息页面”顶部将有一个导航控件(导航栏),控件的其余部分是选项卡控件,以便用户可以随时在选项卡之间切换。如果用户从导航控件中按“下一步”,他们将转到新页面,并且可以通过从下一页按“返回”再次返回到“选项卡视图”。
另外,我还有很多不适合单个选项卡视图的选项卡,因此我希望最后一个选项卡像更多选项一样,并且会转到不同的视图(表格视图的自定义)。
目前我已经开发了 Window 基础应用程序,如下所示。
- 主控制器(MainSwitcherViewController)是从委托初始化的。
这个主控制器引用了多个其他UIViewsController
例如:
- LoginViewController 即 UIViewController。
- MenuViewController 即 UIViewController。
最初我显示 LoginViewController。
- 成功登录后,我会显示 MenuViewController。
- 从 MenuViewController 上的任何操作(选择菜单 - 当前添加为 UIButton),我将打开新视图,但我想进入导航视图和选项卡视图组合视图,而不是新视图(UIViewController),如上所述。
这是我的问题:
- 我设计屏幕/视图的方法是正确的还是我需要采取另一种方法?
- 如何在 UIViewController 和 TabViewController 或 NavigationViewController 之间切换?
- 如何创建在顶部和底部 TabBarViewControl 上具有导航控件的组合控制器,以便每个选项卡导航控件都可见(共享)。
我是 iPhone 应用程序开发的初学者,
请给我一些具有类似示例的指针或链接。
提前致谢。
I want to make the login app with the complicated views.
Requirement flows as below:
Login Page --> Menu Page --> Detail Page with Tab Control. --> Navigation Page
Here the 'Detail Page' is again a combination of two views. Navigation View and Tab View.
i.e. 'Detail Page' will have a Navigation Control (Navigation Bar) on top and rest of the control is a Tab Control so that the user can switch between tabs at any point. If a user presses 'Next' from the navigation control, they will go to new page and can come back again to the 'Tab View' by pressing back from the next page.
Also I have lot more tabs which don't fit into a single tab view so I want the last tab to be like more option and will go to different views (either custom of table view).
Currently I have developed the Window base application as under.
- Main Controller (MainSwitcherViewController) which is got initialized from the delegate.
This main controller has a reference of multiple other UIViewsController
For example:
- LoginViewController which is UIViewController.
- MenuViewController which is UIViewController.
Initially I show the LoginViewController.
- On successful login I show the MenuViewController.
- And from the MenuViewController on any action (selection of Menu - currently added as UIButton), I am opening the NEW View but instead of New View (UIViewController) I want to go in Navigation View and Tab View combination View as explained above.
Here is my question:
- Is my approach of designing the screen/views is correct or do I need to take another approach?
- How to switch between UIViewController to TabViewController or NavigationViewController?
- How to create combined Controller having Navigation Control on Top and on bottom TabBarViewControl such a way that for each tab Navigation Control is visible (shared).
I am a beginner at iPhone app development,
Please give me some pointers or links having similar kinds of examples.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,首先你的方法没问题。您可以在与 UINavigationController 相同的类中拥有 UITabBarController。只需创建选项卡栏控制器,并在同一类中创建导航控制器。用户将能够从该视图中使用两者。
为此,在带有选项卡栏的类中:
然后将视图添加到该选项卡栏控制器。在其中一个 UIViewController 中,添加一个导航控制器:
然后只需将选项卡栏与新视图一起添加到视图中:
记住仅将导航控制器添加到选项卡栏控制器中,因为如果您像平常一样添加类,它就会将不具备导航控制器功能。
希望这有帮助,如果没有,我很乐意澄清任何事情。
Ok, first your approach is fine. You can have a UITabBarController in the same class as a UINavigationController. Just create the tab bar controller and in the same class also create the navigation controller. The user will be able to use both from within that view.
To do this, in the class with the tab bar:
Then add a the Views to that Tab Bar Controller. In one of those UIViewController, add a navigation controller:
then just add the tab bar to the view along with the new views:
remember to only add the navigation controller to the tab bar controller becauase if you add the class as you normally would, it will not have the navigation controller features.
Hope this helps, if not, I'll be happy to clearify anything.