视图控制器/ NIB架构与转换非导航应用? [英] View controller/NIB architecture for non-navigation application with transitions?

查看:121
本文介绍了视图控制器/ NIB架构与转换非导航应用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与(如许多iPad应用程序)不使用UINavigation根视图控制系统的iPad应用程序修修补补,所以我不必为每个应用程序查看天然的所有权。我基本上是有两个基本观点:一个文件列表视图和文档编辑视图

I'm tinkering with an iPad app that (like many iPad apps) doesn't use the UINavigation root view control system, so I don't have natural ownership for each app "view". I essentially have two basic views: a document list view, and a document edit view.

我与UIView的动画播放从选定文档获取到编辑视图。

I'm playing with UIView animation for getting from a selected document to the edit view.

我也有在顶部的工具栏存在(有不同的按钮),在这两个意见。

I also have a toolbar on top that exists (with different buttons) in both "views".

由于我没有UINavigation办展为我做的,我要只是扔更多的东西到一个NIB,并拥有整个容器一个视图控制器的倾向。但现在我想弄清楚如何从文档列表视图编辑视图Segue公司,如果编辑视图过着不同的NIB,$ P $内pserving工具栏了。

Because I don't have UINavigation running the show for me, I have a tendency to just throw more and more stuff into one NIB and one view controller that owns the whole container. But now I'm trying to figure out how to segue from the document list view to the edit view if the edit view lives inside a different NIB, preserving the toolbar too.

任何人有这样的应用程序结构的想法或经验?我找到的文档围绕code / UI结构的最佳实践缺乏任何东西,除了微不足道的一屏的应用程序或全的导航应用。

Anyone have thoughts or experience on app structures like this? I find the docs lacking on best practices around code/UI structure for anything except trivial one-screen apps or full-on navigation apps.

您不是应该有父/子视图控制器拥有根据文档相同的屏的子组件,但是这意味着,基本上包含了整个应用程序一台庞大的乎乎视图控制器,而不能是正确的。

You're not "supposed" to have parent/child view controllers owning subcomponents of the same "screen" according to the docs, but this implies one massive honking view controller that basically contains the whole app, and that can't be right.

不知道是否有一个正确答案这个;我在寻找一些智能的例子或建议。没有人触及这个问题几个月,所以我加入悬赏产生良好的喋喋不休。 :)

Not sure if there's a "right answer" to this; I'm looking for some intelligent examples or suggestions. Nobody's touched this question in months, so I'm adding a bounty to generate good chatter. :)

谢谢!

更新:我不是在谈论一个拆分视图,这显然是深受一个拆分视图控制器处理。相反,看看苹果的iWork应用程序(例如网页),其中有一个文件列表视图和一个独立的编辑的观点,但这些都是由动画相关的。

UPDATE: I'm not talking about a split view, which is clearly well handled by a split view controller. Instead, take a look at Apple's iWork apps (e.g. Pages) which have a document list view and an independent edit view, but these are related by animation.

也许这里真正的问题是:你会如何(?或者可能你连)建立类似的拆分视图或导航控制器,自己一个容器视图控制器?要从头开始构建整个该死的事情,你需要的?我感觉到你,因为似乎是在视图控制器之间的互动被隐藏的布线。如果是这样,对此有何看法?

Maybe the real question here is: how would you (or could you even?) build a "container" view controller like the split view or navigation controller, yourself? Are you required to build the whole damn thing from scratch? I sense that you are, because seems to be hidden wiring in the interaction between view controllers. If so, thoughts on this?

推荐答案

我觉得在视图控制器的唯一隐藏的布线设置parentViewController,这是需要支持申报拆分和导航的类别。

I think the only hidden wiring in view controllers is setting parentViewController, which is required to support the categories declared for split and navigation.

查看控制器被设计为被嵌套,每个控制器拥有视图层次的一部分。唯一的设计目标是没有视图控制器深入到另一个控制器的视图层次结构。父视图控制器通常会有一些要求添加子控制器,以便它可以将其拥有的视图层次中的视图的框架。子视图控制器不应该做任何事情,它控制视图的上海华,因为这是由另一个控制器拥有。不应该把它设置控制所述视图的中心或帧

View controllers are designed to be nested, with each controller owning a part of the view hierarchy. The only design goal is that no view controller reach into the view hierarchy of another controller. A parent view controller will usually have some call for adding child controllers so that it can set the frame of the view within the view hierarchy it owns. A child view controller should not do anything to the superview of the view it controls, as that is owned by another controller. Not should it set the center or frame of the view it controls.

例如,导航控制器具有推挽方法,其中删除了previous控制器视图,增加了新的控制器视图,并设置新添加的视图的帧。在一般情况下,一个父视图控制器自由设定一个子控制器的视图的帧,但不是界限。

For example, a navigation controller has a push method, in which it removes the previous controller view, adds the new controller view, and sets the frame of the newly added view. In general, a parent view controller is free to set the frame of the view of a child controller, but not the bounds.

如果你想改变一个导航控制器的动画,我想你会通过实现与动画中的每个方法启动:参数。设置动画然后调用与动画标志关闭超级犯动画之前。

If you want to change the animation of a navigation controller, I think you would start by implementing every method with an animated: argument. Set up your animation then call super with the animated flag off before committing the animation.

这篇关于视图控制器/ NIB架构与转换非导航应用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆