-
最常用的三个方法:
- (void)addSubview:(UIView *)view;
- (void)insertSubview:(UIView *)view belowSubview:(UIView *)siblingSubview;
- (void)insertSubview:(UIView *)view aboveSubview:(UIView *)siblingSubview;
很容易理解:
从字面也很容易理解吧,bring subview to front,send subview to back。
- (void)exchangeSubviewAtIndex:(NSInteger)index1 withSubviewAtIndex:(NSInteger)index2;
一定要理解正确,不是改变两个图层的位置(即不是改变 frame),二是改变图形顺序(你如果是做 web 的,可以理解为 z-index,就明白了)。
- (void)removeFromSuperview;
这个也很好理解,而且木有参数。
tag 是个标识,注意与视图层次顺序无关。
-
转载请注明来自:http://blog.csdn.net/prevention
iOS Dev (27) 初步了解下UIView的最常用知识
原文:http://blog.csdn.net/prevention/article/details/18383705