IOS UIView 之屬性篇

2021-06-26 16:41:44 字數 2725 閱讀 5340

uiview 之屬性篇  properties

@property(nonatomic) cgfloat alpha   //設定檢視的透明度

//透明度的設定從最小0.0到1.0 ,1.0為完全不透明,

//其中這個屬性只影響當前檢視,並不會影響其子檢視

@property(nonatomic, getter=isopaque) bool opaque

//決定當前檢視是否是透明的

@property(nonatomic) bool autoresizessubviews

//這個屬性是決定當檢視大小邊界發生改變時,其子檢視是否也跟著自動調整大小

@property(nonatomic) uiviewautoresizing autoresizingmask

//決定當當前檢視的父檢視大小發生變化時,當前檢視該怎麼調整自己的size

@property(nonatomic, copy) uicolor *backgroundcolor  //當前檢視的背景色

@property(nonatomic) cgrect bounds

//當前檢視的邊界,包括大小和原點,這裡是在系統座標系下

@property(nonatomic) cgrect frame

//當前檢視的邊界,包括大小和原點,這裡是在父檢視的座標系下

@property(nonatomic) cgpoint center  //當前檢視的中心,並指定是在父檢視的座標系下

@property(nonatomic) bool clearscontextbeforedrawing

//決定在檢視重畫之前是否先清理檢視以前的內容,預設值為yes

//如果你把這個屬性設為no,那麼你要保證能在 drawrect:方法中正確的繪畫。如果你的**

//已經做了大量優化,那麼設為no可以提高效能,尤其是在滾動時可能只需要重新繪畫檢視的一部分

@property(nonatomic) bool clipstobounds

//決定子檢視是否被限定在當前檢視的bounds中,預設值為no

@property(nonatomic) uiviewcontentmode contentmode

//決定當檢視邊界變時呈現檢視內容的方式

@property(nonatomic) cgfloat contentscalefactor

//應用到當前檢視的比例scale

@property(nonatomic, getter=i***clusivetouch) bool exclusivetouch

//決定當前檢視是否是處理觸控事件的唯一物件

@property(nonatomic, copy) nsarray *gesturerecognizers

//當前檢視所附加的手勢識別器

@property(nonatomic, getter=ishidden) bool hidden

//當前檢視是否隱藏

@property(nonatomic, readonly, retain) calayer *layer

//用於檢視渲染的核心動畫層

@property(copy, nonatomic) nsarray *motioneffects

//當前檢視的運動效果,ios7才開始擁有

@property(nonatomic, getter=ismultipletouchenabled) bool multipletouchenabled

//當前檢視是否接受多點觸控事件,預設值為no

@property(nonatomic, copy) nsstring *restorationidentifier

//該標示符決定該檢視是否支援恢復狀態,其實也只是個標示符而已

//個人覺得就相當於配置表檢視每個單元格時使用的標示符一樣,可以直接在記憶體中重用,提高了效能

//還有一點需注意,不應該簡單的定義這個標示符,因為其所屬的view controller ,還有view controller的

//所有 父view controllers都必須有乙個恢復識別符號

@property(nonatomic, readonly, copy) nsarray *subviews  //當前檢視的所有子檢視

@property(nonatomic, readonly) uiview *superview //當前檢視的父檢視

@property(nonatomic) nsinteger tag  //當前檢視的標籤

@property(nonatomic) uiviewtintadjustmentmode tintadjustmentmode

//色調調整模式,開始用於ios7

@property(nonatomic, retain) uicolor *tintcolor

//色調顏色,開始用於ios7

@property(nonatomic) cgaffinetransform transform  //檢視的仿射變換

@property(nonatomic, getter=isuserinteractionenabled) bool userinteractionenabled

//決定與使用者互動事件是否從被忽略並從事件佇列中移除

@property(nonatomic, readonly) uiwindow *window  //當前檢視上的uiwindow物件

以上就是 uiview 這個類的全部屬性。

好了今天就先到這裡,接下來就要開始 uiview 中的方法了。

IOS UIView 之屬性篇

本文 做的放大的時候 想加渲染的,但是uiview的一些渲染屬性是7之後才有的,所以現在來了解一下uiview的屬性吧 uiview 之屬性篇 properties property nonatomic cgfloat alpha 設定檢視的透明度 透明度的設定從最小0.0到1.0 1.0為完全不透...

ios UIView的常用屬性

uiview的常用屬性1 父子檢視屬性 1.superview 獲得自己的父控制項物件 2.subviews 獲得自己的所有子控制項物件 注意 乙個檢視最多只能有乙個父檢視 乙個檢視可以有多個子檢視 uiview的常用屬性2 位置尺寸屬性 1.frame 控制項所在矩形框的位置和尺寸 以父控制項的左...

iOS UIView屬性動畫和常用方法

一 動畫的屬性是指當屬性從乙個值變為另乙個值的時候,可以半自動的支援動畫。1.uiview物件中支援動畫的屬性有 frame 改變檢視的尺寸和位置 bounds 改變檢視的尺寸 center 改變檢視的位置 transform 使用這個可以翻轉或者縮放試圖 alpha 使用這個可以改變檢視的透明度 ...