What happens when a UIView is added to another UIView twice in iOS?

What happens when a UIView is added to another view twice in iOS? I believe this will not be added twice. Has anyone ever tried?

+7
source share
2 answers

[UIView addSubview:] documentation

Views can only have one view. If the view already has a supervisor, and this view is not the recipient, this method deletes the previous supervisor before making the recipient its new supervisor.

+16
source

A view can only have one parent view. But a submission can have many subheadings.

Read the UIView documentation .

In particular, read about addSubView

+2
source

All Articles