UI hierarchy and views inheritance
In this chapter, we already talked about UI hierarchies. Let's dive into the topic by introducing the concepts of subview and superview and learning how to build and manage complex hierarchies.
Every instance of
UIView (or its subclass) can be connected with other views in a parent-child relationship. The parent view is called superview, while the children are called subviews. A view can only have one superview, but it can contain more than one subview:
Thanks to the dedicated
UIView properties and functions, you can easily inspect a view hierarchy and navigate from a root view down through to the last view of the ...