问题描述
我有两个 UIView,UIView1 和 UIView2.UIView2 被添加为 UIView1 的子视图,我想知道的是,如果我调用
I have two UIViews, UIView1 and UIView2. UIView2 is being added as a subview to UIView1, what I would like to know is that if I call
[UIView1 removeFromSuperview];
在 UIView2 上也应用 removeFromSuperView 的剂量?或者我是否也必须在 UIView2 上专门调用它...
dose that also apply the removeFromSuperView on UIView2? or do I specifically have to call that on the UIView2 as well...
任何帮助将不胜感激
推荐答案
UIView---->UIView1------>UIView2
假设你想移除UIView1上的UIView2,你可以这样写
Suppose you want to remove UIView2 on UIView1, just you can write like
[UIView2 removeFromSuperView].
假设你想移除UIView上的UIView1,你可以这样写
Suppose you want to remove UIView1 on UIView, just you can write like
[UIView1 removeFromSuperView].
在这种情况下,UIView2 也被移除了.因为当您删除任何视图时,视图的所有子视图都将被删除.
In this situation, UIView2 is also removed. Because when you remove any view, all subviews of view will be removed.
这篇关于从 superView 中删除 UIView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!