简体   繁体   English

带有静态导航栏的UINavigationController

[英]UINavigationController with static navigation bar

I'm working on an educational iPhone application and am looking for advice on what is the best architecture for a specific portion of my app. 我正在研究一个教育性的iPhone应用程序,并正在寻找有关应用程序特定部分的最佳体系结构的建议。

I'm working with iOS 5 so I can use container view controllers. 我正在使用iOS 5,因此可以使用容器视图控制器。 I want to do as much as possible in the storyboard. 我想在情节提要中尽可能多地做。

Here's what I want to do: 这是我想做的:

  • some data items are listed in a table view controller. 表视图控制器中列出了一些数据项。
  • when the user clicks on one of these items, we start a study session by presenting its main view controller modally. 当用户单击这些项目之一时,我们将以模态显示其主视图控制器来开始学习会话。
  • a study session is composed of 4 view controllers that are pushed from the right, one after another. 一个学习会话由从右向后推入的4个视图控制器组成。
  • these four screens have a navigation bar with: 这四个屏幕都有一个导航栏,其中包含:
    • the same title. 相同的标题。
    • the same left item: a "Close" button that will dismiss the whole modal study session. 左侧相同的项目:“关闭”按钮,将取消整个模态学习课程。
    • two of them have a screen-specific right item, the other two don't. 其中两个有特定于屏幕的权限项目,其他两个则没有。
  • the transitions between these four screens should be animated in a UINavigationController style, but the navigation bar shouldn't be animated. 这四个屏幕之间的过渡应该以UINavigationController样式进行动画处理,但是不应对导航栏进行动画处理。

Here is a way I'm thinking of for implementing this behavior: 这是我正在考虑的用于实现此行为的方法:

Showing modally a custom container view controller that would contains: 模态显示自定义容器视图控制器,其中将包含:

  • a UINavigationController without navigation bar, where I would push my screens 没有导航栏的UINavigationController,我将在其中推送屏幕
  • a separate UINavigationBar that would stay above the navigation controller. 一个单独的UINavigationBar,它将位于导航控制器上方。

The screens would define their navigation bar's right item if any, and the container view controller would be responsible for putting it in the navigation bar. 屏幕将定义其导航栏的正确项(如果有),并且容器视图控制器将负责将其放置在导航栏中。

Does someone have an opinion on this method, or an elegant alternative to suggest? 有人对此方法有意见吗,还是可以建议的优雅替代方法?

Thanks. 谢谢。 Have a great day! 祝你有美好的一天!

you can use Single View based project for this purpose. 您可以为此使用基于单视图的项目。 Add a navigation controller to push when user clicks on tableview content. 添加导航控制器以在用户单击表视图内容时进行推送。 By pushing with animation, your view will be transitioned from tableview to another view controller. 通过推动动画,您的视图将从tableview过渡到另一个视图控制器。

Now you can show up your first chapter and add a swipe gesture to your view so as to change the page. 现在,您可以显示第一章,并向视图中添加滑动手势以更改页面。

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

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