简体   繁体   English

顶部和底部的标签栏

[英]Tab bar at top and bottom

I would like to develop a ipad apps which has a menu at the top of the screen as well as at the bottom. 我想开发一个ipad应用程序,它在屏幕顶部和底部都有一个菜单。

There are four buttons on the top of the screen, and there are 10+ buttons at the bottom tab bar, which can be scrolled horizontally. 屏幕顶部有四个按钮,底部标签栏有10个以上的按钮,可以水平滚动。

How can I write the root view controller as a framework for this operation? 如何编写根视图控制器作为此操作的框架?

Should I customize the UIViewController class or UITabBarViewController? 我应该自定义UIViewController类还是UITabBarViewController?

Thanks 谢谢

EDIT: 编辑:

Sorry for being unclear. 抱歉,不清楚。 Let me restate my question. 让我重申我的问题。

Actually my app will have the following hierarchy. 实际上,我的应用程序将具有以下层次结构。

在此处输入图片说明

'Front Page' is simply a page (view controller) for user to choose language. “首页”只是供用户选择语言的页面(视图控制器)。 After choosing the language, 'Menu Page' view controller is displayed. 选择语言后,将显示“菜单页面”视图控制器。

Starting from Menu page and ALL view controllers (VC) in below, the page layout is something like this. 从菜单页面和下面的所有视图控制器(VC)开始,页面布局是这样的。

在此处输入图片说明

As you can see, there are top menu and bottom menu. 如您所见,有顶部菜单和底部菜单。 Clicking on the buttons the app will quickly jump to the corresponding view controller (3rd level in the tree, VC1,VC2,VC3 etc) . 单击按钮,应用程序将快速跳转到相应的视图控制器(树中的第三级,VC1,VC2,VC3等)。 And for every view, there is a BACK button on every page, clicking which will back to the parent view controller. 对于每个视图,每个页面上都有一个“返回”按钮,单击该按钮将返回到父视图控制器。

I was thinking to implement this by using a tab bar view controller and a navigation view controller but I still do not have a clear idea how to implement this. 我当时正在考虑通过使用选项卡栏视图控制器和导航视图控制器来实现此功能,但是我仍然不清楚如何实现此功能。

Or maybe should I just use the navigation view controller and hide the top tool bar except the back button, and display an overlay UIView as menu which is on top of all other UIViews. 或者,也许我应该只使用导航视图控制器并隐藏除“后退”按钮之外的顶部工具栏,并在所有其他UIView的顶部显示一个叠加的UIView作为菜单。

Can somebody help me? 有人可以帮我吗? Thanks. 谢谢。

Since this is the outermost container for my app I hope to do it properly at start.. 由于这是我应用程序的最外层容器,因此我希望一开始就可以正确执行此操作。

Sorry for my long question. 对不起,我的问题很长。

If you really want to develop a framework for this logic .You need to create Manager, ViewController, View, DAO ,Model and other classes according to your needs. 如果您真的想为此逻辑开发框架,则需要根据需要创建Manager,ViewController,View,DAO,Model和其他类。

I assume you want to add the buttons dynamically to the tabbar (and if it scrollable , it must be a scrollview).You can use Toolbar for upper view but then it won't be in sync with the bottom-view(visually).In that case you will have to create your own customized views to look like a tabbar. 我假设您想动态地将按钮添加到选项卡中(如果它是可滚动的,则必须是滚动视图)。您可以使用工具栏作为上视图,但是它不会与底视图同步(在视觉上)。在这种情况下,您将必须创建自己的自定义视图,使其看起来像一个标签栏。

The manager will basically keep a track of all the buttons and different states of events and action on the views and the same information can be accessed via a static method form the viewcontroller. 管理器基本上将跟踪所有按钮以及视图上事件和操作的不同状态,并且可以通过视图控制器的静态方法访问相同的信息。

Well you have not detailed on your needs , so it's difficult to predict the entire architecture. 嗯,您尚未详细说明自己的需求,因此很难预测整个体系结构。

You need a container view controller to manage selection of VC's 1-4. 您需要一个容器视图控制器来管理VC 1-4的选择。

clicking which will back to the parent view controller 单击哪个将返回到父视图控制器

Parent view controller is used to mean the container vc in a container view controller scheme - I'm not sure that's what you mean in this comment. 父视图控制器用于表示容器视图控制器方案中的容器vc-我不确定这是您在此注释中所说的。 Where exactly does the back button go? 后退按钮到底在哪里?

See this link for more info about container VC's. 有关容器VC的更多信息,请参见此链接。

https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/CreatingCustomContainerViewControllers/CreatingCustomContainerViewControllers.html https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/CreatingCustomContainerViewControllers/CreatingCustomContainerViewControllers.html

You should be able to embed a tab bar controller in the content view of the container VC. 您应该能够在容器VC的内容视图中嵌入选项卡栏控制器。 Should be able to but it might be really buggy if there is a lot of communication between the child vc's. 应该可以,但是如果子vc之间的通信很多,则可能确实有问题。

The hard part is the back button. 困难的部分是后退按钮。 Basically it must be a button that goes back to VC 1-4 depending on which section you are in. The easiest way to do it is to make sure that when you cycle view controllers, pass the back button information as to which VC is the current child so it knows which VC to navigate to when you press it. 基本上,它必须是一个返回到VC 1-4的按钮,具体取决于您所在的部分。最简单的方法是确保在循环视图控制器时,传递关于哪个VC是哪个VC的后退按钮信息。当前的孩子,因此当您按下它时,它知道要导航到哪个VC。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM