iOS development - UIView -

iOS development - UIView

ios, programming, mobile development
class UIView : UIResponder

The UIView class API provides general behavior for any view in an application. This general behavior includes displaying content and handling user interactions. By default, UIView enables setting a static background color. This simple behavior can be extended through subclassing. UIKit includes built-in UIView subclasses such as UILabel, UIImage, UIButton, and more, which are ready to be used for constructing custom views.

Views handle:

  • drawing and animation (using UIKit or Core Graphics)
  • layout and subview management
  • user events (UIView is a subclass of UIResponder, enabling it to respond to user interactions)

Views can be created using a visual tool like Storybook, or programmatically.

Views will be drawn (and redrawn) by the system using an internal lifecycle, called the “drawing cycle”.

Views are often organized hierarchically, such that related content is nested together, not unlike HTML. “Subviews” can visually overflow their “superviews” by default, but this can be changed via the clipsToBounds property.

Views contain frame and bounds properties which define the origin and dimensions relative to the superview and the internal dimensions of the view, respectively.

View changes and multithreading

Manipulations to views must always occur on the main thread of the application, meaning that UIView class methods should only ever be called by code running on the main thread.

–> Source ↗