Can UIViewController contain more than one UIView?
-
07-07-2019 - |
Question
Can a UIViewcontroller
contain more than one UIView
?
Solution
Yes, many.
Each button, or text field or image, or ... is a view. A view controller can handle many many views. Of course, there is one view that is the parent of all others, and the view controller keeps track of that one and can then follow the tree down to handle the children (for the purposes of handling touch, or updating, etc.).
OTHER TIPS
For clarity, NO. A UIViewController has one UIView. That UIView, like all UIViews, can contain subviews. If you want to control two views, create instance variables for each of them and add them both to your UIViewController's view variable.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow