IOS UIView 对象详解
生活随笔
收集整理的這篇文章主要介紹了
IOS UIView 对象详解
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
UIView 是所有可以顯示在屏幕的對象的父類,是一個矩形的對象
| bounds | CGRect | 以自己左上角為原點坐標設置位置和尺寸 | nil |
| frame | CGRect | 以父級視圖點左上角為原點設置位置和尺寸 | nil |
| tag | NSInteger | 當前對象點標識,可以當作id | nil |
| conter | CGPoint | 視圖的中心點,可動畫 | nil |
| transform | CGAffineTransform | 動畫 | CGAffineTransformIdentity |
| transform3D | CATransform3D | 3D動畫 | CATransform3DIdentity |
| alpha | CGFloat | 透明度 | 1.0 |
| hidden | BOOL | 是否顯示 | YES | |
| contentMode | UIViewContentMode | 內容顯示模式,常用于圖片顯示方式模式,默認為縮放填充 | UIViewContentModeScaleToFill |
| maskView | UIView | 視圖遮罩層 | nil |
| window | UIWindow | 程序的window對象 | window |
| userInteractionEnabled | BOOL | 是否響應用戶操作事件,設為否將忽略用戶操作響應 | YES |
| autoresizesSubviews | BOOL | 子視圖是否可響應本視圖的bounds變化進行自動布局 | YES |
| autoresizingMask | UIViewAutoresizing | 根據父級視圖的bounds變化進行自動布局(通常根據父級視圖變化同比例變化),可選UIViewAutoresizingFlexibleWidth自動設置寬度UIViewAutoresizingFlexibleHeight自動設置高度 UIViewAutoresizingFlexibleLeftMargin自動設置左邊距,UIViewAutoresizingFlexibleRightMargin自動設置右邊距等等 | UIViewAutoresizingNone |
API
- - (void)removeFromSuperview 從父級視圖中移除
- - (void)insertSubview:(UIView *)view atIndex:(NSInteger)index 添加子視圖并且指定層級
- - (void)exchangeSubviewAtIndex:(NSInteger)index1 withSubviewAtIndex:(NSInteger)index2 交換兩個子視圖的層級
- - (void)addSubview:(UIView *)view 添加子視圖
- - (void)insertSubview:(UIView *)view belowSubview:(UIView *)siblingSubview 添加子視圖并且在指定視圖下
- - (void)insertSubview:(UIView *)view aboveSubview:(UIView *)siblingSubview 添加子視圖并且在指定視圖上
- - (void)bringSubviewToFront:(UIView *)view 將視圖頂置
- - (void)sendSubviewToBack:(UIView *)view 將視圖置底
- - (void)layoutSubviews 布局發生變化布局子視圖時候觸發。
總結
以上是生活随笔為你收集整理的IOS UIView 对象详解的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: javascript 中文排序 loca
- 下一篇: lntellijidea怎么创建文件_D