开发者

Does every UIView need a controller, or can a controller control several views?

开发者 https://www.devze.com 2023-04-11 04:47 出处:网络
Does every UIView need a controller, or can a controller manage several views? If a controller can manage multiple views, how can this be don开发者_开发知识库e?no, not every view needs it\'s own ViewC

Does every UIView need a controller, or can a controller manage several views? If a controller can manage multiple views, how can this be don开发者_开发知识库e?


no, not every view needs it's own ViewController: If you just create your own view which contains labels, textfields, etc then your ViewController will control your view and the instances of textfields ...

But in most cases it is useful to create for every new created view its own viewcontroller.


A view controller does exactly what it says: control views.

A view is simply something that can render itself on screen, it doesn't know anything about behavior.

Not every view has a view controller, far from it. Most views are subviews to other views, which are in turn controlled by the parent view controller.

For the most part, only one view controller is used at a time.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号