iPad/iOS:管理多个全屏视图?
我的应用程序需要在几个全屏视图之间切换。这些视图通过自定义覆盖菜单中的按钮进行切换。
没有可见的选项卡栏或导航栏。视图之间的过渡可以是动画的,也可以不是。
正如我所看到的,我可以使用单个 UIViewController 并交换子视图来获得所需的效果,或者使用多个 UIViewController 并使用一个 Apple 的容器(例如导航控制器、选项卡栏控制器等),隐藏导航栏/选项卡栏并以编程方式切换“选项卡”或推/弹出控制器。我认为第三个选项是以模态方式显示每个新视图,但这感觉不对。
访问视图没有“顺序”,所以我的猜测是导航控制器方法实际上没有意义。
这两种方法都有什么主要缺点吗?您还有其他建议吗?如果我隐藏导航和标签栏控制器上的导航栏或标签栏,Apple 会拒绝该应用程序吗?
预先感谢您提供的任何建议。
My app needs to switch between a couple of full screen views. These views are toggled by buttons in a custom overlay menu.
There are no tab bars or navigation bars visible. The transition between views may or may not be animated.
As I see it I can either use a single UIViewController and swap out subviews to get the desired effect or use multiple UIViewControllers and use of one Apple's containers (eg navigation controller, tabbar controller, etc), hide the navbar/tabbar and programatically switch "tabs" or push/pop controllers. The third option I suppose is to show each new view modally, but this doesn't feel right.
There is no 'order' in which the views are accessed, so my guess is the navigation controller approach won't really make sense.
Are there any major cons in either approach? Do you have any other suggestions? Will Apple reject the app if I hide the navbar or tabbar on navigation and tabbar controllers?
Thanks in advance for any advice you can offer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不会使用 UINavigationController、模态窗口或 UITabBarController。后者有一些可能性,但在一般使用中太尴尬而不适合。
相反,请尝试在窗口上使用
setRootViewController:
,因为这相当灵活,而且比其他方法开销更少。在多个
UIViewController
子类之间进行选择或UIView
交换取决于您的应用程序的总体工作方式。 UIView 喜欢独立,并限制与控制器的通信,但对于更多面向显示的内容非常有用。I wouldn't use
UINavigationController
, modal windows, or aUITabBarController
. The latter has some possibilities, but is too awkward in general use to be suitable.Instead, try to use
setRootViewController:
on the window, as this is reasonably flexible with less overhead than the other approaches.Choosing between multiple
UIViewController
subclasses orUIView
swapping depends on how your app will be working in general. UIViews like to be separate, and restrict communication to your controller, but are great for more display oriented content.