IOS series basics 05 view originator, ios Basics
IOS series basics 05 view originator-UIView
Directory:
In the Cocoa and Cocoa Touch frameworks, the "root" class is the NSObject class. Similarly, in the UIKit framework, there is also a magic class-UIView.
From the perspective of inheritance relationships, UIView is the root of all views and is called as the "ancestor" in an image ".
In this article, we will study the magic of UIView.
1. UIView "family"
UIView "family" is generally divided into "controls" and "views", both of which are inherited from UIView.
Inheritance level of the UIView class
The following briefly introduces the meanings of these three attributes:
- Superview:Obtain the parent view object.
- Subviews:Obtains a set of child view objects.
- Window:Obtain the UIWindow object of the view.
3. View Classification
To facilitate development, Apple divides the view in the UIKit framework into the following categories:
- Controls:Inherits from the UIControl class to respond to advanced events of users.
- Window:It is a UIWindow object, and an iOS app only has one UIWindow object. It is the "root" container of all sub-views.
- Container View:It includes UIScrollView, UIToolbar, and their subclasses. UIScrollView subclasses include UITextView, UITabView, and UICollectionView. When the content exceeds the screen, they can provide horizontal or vertical scroll bars. UIToolbar is a very special container that can contain other controls. It is usually placed at the bottom of the screen and can also be placed at the top of the screen in special cases.
- Display View:Displays information, including UIImageView, UILabel, UIProgressView, and UIActivityIndicatorView.
- Text and Web views:Provides a view that can display multiple lines of text, including UITextView and UIWebView. UITextView also belongs to the container view, and UIWebView is a view that can load and display HTML code.
- Navigation View:Provides navigation (or navigation) views from one screen to another, including UITabBar and UINavigationBar.
- Warning box and operation table:It is used to provide users with feedback or interact with users. The UIAlertView is a warning box that pops up as an animation. The UIActionSheet view provides users with optional operations, which slide out of the bottom of the screen.
Note:
In the future, we will encounter many views (such as UILabel, text view, and progress bar) that do not inherit the UIControl class, but we are also used to being called "controls ", this is a common classification method as agreed in development, which is different from the conceptual classification in a strict sense.
4. Last
There is no end and it seems strange ..