简体   繁体   English

为什么要使用许多视图控制器来制作应用程序?

[英]Why use many view controllers to make app?

Is it possible if we can create many views for one controller and use less number of view controller to make app. 如果我们可以为一个控制器创建多个视图并使用较少数量的视图控制器来制作应用程序,这是否有可能? So, lets suppose we have 4 view controllers at a moment and each view controllers contains 4 or 5 views each covering the whole screen and later, we manage the views according to our needs like hiding the views which are not needed. 因此,假设我们一次有4个视图控制器,每个视图控制器包含4个或5个视图,每个视图都覆盖整个屏幕,然后,我们根据需要管理视图,例如隐藏不需要的视图。

Sorry if i am asking bad question. 对不起,如果我问一个坏问题。 Just want to clear the things. 只想清除事物。

You can certainly do it that way if you wish - but you'll soon find that your view controller code is huge and is very difficult to manage since you'll have the logic for multiple views all in there and you have to handle the transition for all those separate views and so on. 当然,如果您愿意的话,也可以这样做。但是您很快就会发现,视图控制器代码庞大且难以管理,因为您将拥有多个视图的逻辑,并且您必须处理过渡所有这些单独的视图等等。

But, there is nothing stopping you from doing that except for the principles of good design :) 但是,除了良好的设计原则之外,没有什么可以阻止您这样做:)

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

相关问题 我将在此应用设置中使用多少个视图控制器? - How many view controllers would I use in this app setup? iMessage App扩展可以使用宿主应用程序中定义的View Controller吗? - Can an iMessage App extension use View Controllers defined in the host app? 多少个视图控制器就是太多的视图控制器? - How many view controllers is too many view controllers? MMDrawerController并实例化许多视图控制器 - MMDrawerController and instantiating many view controllers uiTableView中的许多视图控制器 - Many view controllers from uiTableView 许多视图控制器 - 性能问题 - Many view controllers - performance issue 为什么在旋转应用程序时会在所有视图控制器中调用 viewWillTransition 方法? - Why viewWillTransition method call in all view controllers when rotate the app? 使用差异视图控制器 - Use of differenct view controllers 如何在多个视图控制器中制作一个iAd标语的共享实例? - How to make a single shared instance of iAd banner throughout many view controllers? 在iOS中,是否有关于应用程序在导航堆栈中应具有多少个视图控制器的准则? - In iOS, are there any guidelines for how many view controllers an app should have in a navigation stack?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM