序
UIKit 为App提供了一些核心功能对象:与系统互动、运行App的主事件循环以及在屏幕上显示的内容。
UIKit 结构基于 MVC 的设计模式。 模型对象管理App的数据和业务逻辑。 视图对象提供数据的直观展示。 控制器对象充当模型和视图对象之间的桥梁。
UIKit 提供了一个UIDocument 对象,用于管理属于磁盘文件的数据结构。UIKit定义了UIView类,通常用于在屏幕上显示内容。UIApplication 对象负责运行App的主时间循环和管理App的整个生命周期。
上述内容参考官方文档: 关于使用 UIKit 开发 App - 简体中文文档 - Apple Developer
一. UIKit 框架
1.1 管理App’s 生命周期
The following figure shows the state transitions for scenes. When the user or system requests a new scene for your app, UIKit creates it and puts it in the unattached state. User-requested scenes move quickly to the foreground, where they appear onscreen. A system-requested scene typically moves to the background so that it can process an event. For example, the system might launch the scene in the background to process a location event. When the user dismisses your app’s UI, UIKit moves the associated scene to the background state and eventually to the suspended state. UIKit can disconnect a background or suspended scene at any time to reclaim its resources, returning that scene to the unattached state.
App 在进入前后台、active 和 inactive的时机,都会有对应的回调delegate方法给到应用程序,开发者需要根据App的自身定位,处理UI的展示和事件。
1.2 用户界面
在屏幕上显示你的内容,并定义配合内容的互动。
1.2.1 视图和控件
视图和控件是App用户界面的视觉组成要素。
UIView 是所有视图的根类,并定义视图的通用行为。
UIControl 定义特定的按钮、开关以及类似专门为用户互动设计的其他视图行为。
容器视图
UITableView
UICollectionView
UIStackView
UIScrollView
内容视图
UIActivityIndicatorView
UIImageView
UIPickerView
UIProgressView
WKWebView
控件
UIControl
UIButton
UIDatePicker
UIPageControl
UISegmentedControl
UIStepper
UISwitch
文本视图
UILabel
UITextField
UITextView
UISearchTextField
UISearchToken
视觉效果
UIVisualEffect
UIVisualEffectView
UIVibrancyEffect
UIBlurEffect
栏
UIBarItem
UIBarButtonItem
UIBarButtonItemGroup
UINavigationBar
UISearchBar
UIToolbar
UITabBarItem
思考
UIView 的frame 和bounds的区别?
The frame rectangle, which describes the view’s location and size in its superview’s coordinate system.
The bounds rectangle, which describes the view’s location and size in its own coordinate system.
持续更新ing…