這個(gè)方法會(huì)使被添加的view內(nèi)存計(jì)數(shù)+1
Adds a view to the end of the receiver’s list of subviews.
把一個(gè)視圖添加到接收者子視圖列表的尾部码邻。
func addSubview(_ view: UIView)
參數(shù)
The view to be added. After being added, this view appears on top of any other subviews.
要被添加的視圖骑丸。添加以后趋箩,這個(gè)視圖會(huì)出現(xiàn)在其他所有子視圖的頂部畦娄。
討論
This method establishes a strong reference to view and sets its next responder to the receiver, which is its new superview.
這個(gè)方法對(duì)視圖建立一個(gè)強(qiáng)引用并且把接收者設(shè)置為它的下一個(gè)響應(yīng)者谐算,也是它的新的父視圖熟尉。
Views can have only one superview. If view already has a superview and that view is not the receiver, this method removes the previous superview before making the receiver its new superview.
每個(gè)視圖只能擁有一個(gè)父視圖。如果視圖已經(jīng)有了一個(gè)父視圖并且那個(gè)視圖不是接收者洲脂,這個(gè)方法會(huì)移除先前的父視圖斤儿,然后才把接收者設(shè)置為新的父視圖。