Solving UIView questions
UIView is the basic building block for user interaction in iOS UIKit. At its roots, it represents a rectangle on the screen that can display graphics and handle user interactions and animations.
Before we go over any interview questions, it is crucial to understand the roles of UIView in UIKit, and its relationship with CALayer.
Let’s go over the main features of UIView:
- Manage subviews: UIView can contain additional UIViews called subviews, which can include their own subviews. This capability allows us to build complex UIs and reusable components. UIView is also responsible for handling the layout of its subviews using the Auto Layout system we discussed in the previous chapter.
- Respond to user interaction: Another important role UIView has is to respond to user interaction, which is not a minor topic. Preparing for the interview involves learning about the responder chain, which handles user interactions with UIView’s hierarchy...