控制器、子控制器和视图的结构
我正在尝试构建我的 iPhone 应用程序,并想知道我是否走在正确的轨道上。我没有使用任何导航控制器或选项卡栏控制器:
- 我从 AppDelegate 开始,并在其中放入一个 rootViewController
- 这个 rootViewController 初始化另外两个 viewController 并负责在它们之间进行交换
- 这两个 viewController 中的每一个都会添加额外的 viewController 并负责交换他们之间
<预置><代码> 根 | VC1------VC2 | VC2.1---VC2.2----VC2.3等
我想知道这个设置是否正确或完全有缺陷。我应该使用视图而不是视图控制器吗?在相同的情况下,视图控制器有相当大的层次结构,我想这不是很好的做法。例如,在上面的示例中,VC2.3 由 VC2 调用,VC2 由 ROOT viewController 调用。
I'm trying to structure my iPhone app and was wondering if I'm on the right track. I'm not using any Navigation Controller or Tab Bar Controller:
- I start with the AppDelegate and put a rootViewController in it
- This rootViewController inits two other viewControllers and is responsible for swapping between them
- Each of these two viewControllers adds additional viewControllers and is responsible for swapping between them
ROOT | VC1------VC2 | VC2.1---VC2.2----VC2.3 etc.
I was wondering if this is setup is OK or totally flawed. Should I rather use views instead of viewControllers? In same instances, there is quite a huge hierarchy of viewControllers and I guess this isn't very good practice. E.g. in the example above VC2.3 is called by VC2 which is called by the ROOT viewController.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如上面的评论中提到的,您不必有可见的导航栏即可使用导航控制器的功能。我强烈建议您使用导航控制器。
As mentioned in the comments above you don't have to have a visible navigation bar in order to use the functionality of the navigation controller. I strongly reccommend you use a navigation controller.