标签: iOS,苹果开发文档
- addSubview:
Adds a view to the end of the receiver’s list of subviews.
Declaration
SWIFT
func addSubview(_ view: UIView)
OBJECTIVE-C
- (void)addSubview:(UIView * _Nonnull)view
Parameters
view
The view to be added. After being added, this view appears on top of any other subviews.
这个视图被添加,添加之后,这个视图会显示在其他所有子视图的上面。
Discussion
This method establishes a strong reference to view and sets its next responder to the receiver, which is its new superview.
这个方法会建立一个强引用
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.
视图仅仅会有一个父视图。如果视图已经有一个父视图并且它不是这个视图的接收者,这个方法会把视图移除从前一个父视图,再加到新的父视图中。
网友评论