zoukankan      html  css  js  c++  java
  • iOS

    1、UIKit 框架基本结构

    • 1)控件

      • 屏幕上的所有 UI 元素都叫做控件(也有叫做视图、组件),比如按钮(UIButton)、文本(UILabel)都是控件。

      • 为了便于开发者打造各式各样的优秀 App,UIKit 框架提供了非常多功能强大又易用的 UI 控件,但并不是每一个都很常用,有些控件可能 1 年内都用不上,有些控件天天用,比如 UIButton、UILabel、UIImageView、UITableView 等等。

      • 每个控件都是个容器,能容纳其他控件。内部小控件是大控件的子控件,大控件是内部小控件的父控件。

      • 一个控件看不见有哪些可能:

        • 宽度或者高度其实为 0
        • 位置不对(比如是个负数或者超大的数,已经超出屏幕)
        • hidden == YES
        • alpha <= 0.01
        • 没有设置背景色、没有设置内容
        • 可能是文字颜色和背景色一样
    • 2)控件坐标系

      • 在 UIKit 中,坐标系的原点(0,0)在左上角,x 值向右正向延伸,y 值向下正向延伸。

        UIKit20

    1.1 各控件之间的层次结构

    			   |—— UIAcceleration
        		   |
    			   |—— UIAccelerometer
    			   |
        		   |—— UIAccessibilityElement
    			   |
    			   |—— UIActivity
    			   |                                    |—— UIBarButtonItem
    			   |—— UIBarItem ——————————————————————-|
        		   |                                    |—— UITabBarItem
    			   |—— UIBeziPath
    			   |
        		   |—— UIColor
    			   |
    			   |—— UIDevice
        		   |
    			   |—— UIDocumentInteractionController
    			   |
        		   |—— UIEvent
    			   |
    			   |—— UIFont                           |—— UILongPressGestureRecognizer  |—— UIWindow
        		   |                                    |                                 |
        		   |—— UIGestureRecognizer —————————————|—— UIPanGestureRecognizer        |—— UILabel
    			   |                                    |                                 |
    			   |—— UIImage                          |—— UIPinchGestureRecognizer      |—— UIPickerView
        		   |                                    |                                 |
    			   |—— UILocalizedIndexedCollation      |—— UIRotationGestureRecognizer   |—— UIProgressView
    			   |                                    |                                 |
        		   |—— UILocalNotification              |—— UISwipeGestureRecognizer      |—— UIActivityIndicatorView       |—— UITextView    
        		   |                                    |                                 |                                 |
        		   |—— UIMenuController                 |—— UITapGestureRecognizer        |—— UIImageView                   |—— UITableView
        		   |                                                                      |                                 |
    	NSObject ——|—— UIMenuItem                                                         |—— UIScrollView ——————————————-——|—— UICollectionView
    			   |                                                                      |
    			   |—— UINavigationItem                                                   |—— UITabBar
    			   |                                                                      |
    			   |—— UINib                                                              |—— UIToolbar                     |—— UIStepper
        		   |                                                                      |                                 |
    			   |—— UIPasteboard                                                       |—— UINavigationBar               |—— UIButton
    			   |                                                                      |                                 |
        		   |—— UIPopoverController              |—— UISimpleTextPrintFormatter    |—— UITableViewCell               |—— UIDatePicker
    			   |                                    |                                 |                                 |
        		   |—— UIPrintFormatter ———————————————-|—— UIMarkupTextPrintFormatter    |—— UIActionSheet                 |—— UIPageControl
    			   |                                    |                                 |                                 |
        		   |—— UIPrintInfo                      |—— UIViewPrintFormatter          |—— UIAlertView                   |—— UISegmentedControl
    			   |                                                                      |                                 |
    			   |—— UIPrinInteractionController                                        |—— UISearchBar                   |—— UITextField
        		   |                                                                      |                                 |
    			   |—— UIPrintPageRender                |—— UIApplication                 |—— UIWebView                     |—— UISlider
    			   |                                    |                                 |                                 |
        		   |—— UIPrintPaper                     |—— UIView ———————————————————————|—— UIControl ————————————————————|—— UISwitch
    			   |                                    |
    			   |—— UIResponder ———————————————-—————|—— UIViewController —————————————|—— UISplitViewController
    			   |                                                                      |
    			   |—— UIScreen                                                           |—— UITabBarController
        		   |                                                                      |
    			   |—— UIScreenMode                                                       |—— UITableViewController
    			   |                                                                      |                              |—— UIImagePickerController
    			   |—— UISearchDisplayController                                          |—— UINavigationController ————|
        		   |                                                                      |                              |—— UIVideoEditorController
    			   |—— UITextChecker                                                      |—— UICollectionViewController
    			   |                                                                      |
        		   |—— UITextInputStringTokenizer                                         |—— UIPageViewController
    			   |                                                                      |
    			   |—— UITextPosition                                                     |—— UIActivityViewController
        		   |
    			   |—— UITextRanger
    			   |
        		   |—— UITouch
    			   |
        		   |—— CMMotionManager
    

    1.2 各控件关联说明

    	UIWindow                          : UIView                     窗口
    
            UIApplication                     : UIResponder                应用
    
            UIView                            : UIResponder                视图
    
                UILabel                           : UIView                    标签
                UIProgressView                    : UIView                    进度条
                UIAlertView                       : UIView                    警告框
                UIActionSheet                     : UIView                    操作表
                UIPickerView                      : UIView                    选择框
                UIActivityIndicatorView           : UIView                    风火轮
                UIImageView                       : UIView                    图像视图
                UIWebView                         : UIView                    网页视图
                UIScrollView                      : UIView                    滚动视图
                UITextView                        : UIScrollView              多行文本视图
                UIToolbar                         : UIView                    工具条
        
            UIControl                         : UIView                     控制器
    
                UITextField                       : UIControl                 文本框控件
                UIButton                          : UIControl                 按钮控件
                UISwitch                          : UIControl                 开关按钮控件
                UISegmentedControl                : UIControl                 选择控件
                UISlider                          : UIControl                 滑块控件
                UIStepper                         : UIControl                 微调器控件
                UIDatePicker                      : UIControl                 日期选择器控件
    
            UIViewController                  : UIResponder                视图控制器
    
                UITableViewController             : UIViewController          表格视图控制器
                    UITableView                   : UIScrollView              表格视图
                    UITableViewCell               : UIView                    表格视图单元
    
                UINavigationController            : UIViewController          导航视图控制器
                    UINavigationBar               : UIView                    导航条
    
                UITabBarController                : UIViewController          标签视图控制器
                    UITabBar                      : UIView                    标签条
            
                UICollectionViewController        : UIViewController          网格视图控制器
                    UICollectionView              : UIScrollView              网格视图
    
                UIPageViewController              : UIViewController          页视图控制器
                    UIPageControl                 : UIControl                 页控件
    
                UISplitViewController             : UIViewController          分割视图控制器
    
                UIImagePickerController           : UINavigationController    图像选择视图控制器
    
                UIActivityViewController          : UIViewController          分享视图控制器
                    UIActivity                    : NSObject                  分享
    
                UISearchController                : NSObject                  搜索视图控制器
                    UISearchBar                   : UIView                    搜索条
    
                UIAlertController                 : UIViewController          警告视图控制器
    
            UIColor                           : NSObject                   颜色
            
            UIDevice                          : NSObject                   设备信息                
    
            CMMotionManager                   : NSObject                   加速度传感器
    
            UIGestureRecognizer               : NSObject                   手势检测
                UITapGestureRecognizer            : UIGestureRecognizer       点击手势
                UILongPressGestureRecognizer      : UIGestureRecognizer       长按手势
                UIRotationGestureRecognizer       : UIGestureRecognizer       旋转手势
                UIPinchGestureRecognizer          : UIGestureRecognizer       捏合手势
                UIPanGestureRecognizer            : UIGestureRecognizer       拖动手势
                UISwipeGestureRecognizer          : UIGestureRecognizer       滑动手势
    
            UITouch                           : NSObject                   触摸
        
            AudioServicesPlayAlertSound       :                            短频音效播放
    
            AVAudioPlayer                     : NSObject                   音频播放
    
            MPMoviePlayerViewController       : UIViewController           视频播放视图控制器
                MPMoviePlayerController           : NSObject                  视频播放控件
    
            AVPlayerViewController            : UIViewController           音视频播放视图控制器
                AVPlayer                          : NSObject                  音视频播放控件
    

    2、各控件功能说明

    2.1 文字显示

    UIKit1

    UIKit2

    UIKit3

    2.2 进度显示

    UIKit4

    UIKit5

    UIKit6

    2.3 弹框提醒

    UIKit7

    UIKit8

    2.4 滚动视图

    UIKit9

    UIKit10

    UIKit11

    UIKit12

    UIKit13

    2.5 内容选择

    UIKit14

    UIKit15

    UIKit16

    UIKit17

    2.6 工具条

    UIKit18

    UIKit19

  • 相关阅读:
    Atitti. 语法树AST、后缀表达式、DAG、三地址代码
    Atitit.antlr实现词法分析
    Atitit.antlr实现词法分析
    Atitit.词法分析的理论原理 part2
    Atitit.词法分析的理论原理 part2
    atitit.词法分析原理 词法分析器 (Lexer)
    atitit.词法分析原理 词法分析器 (Lexer)
    Atitti.数据操作crud js sdk dataServiceV3设计说明
    Atitti.数据操作crud js sdk dataServiceV3设计说明
    Atitit.http代理的实现 代码java php c# python
  • 原文地址:https://www.cnblogs.com/QianChia/p/5806777.html
Copyright © 2011-2022 走看看