UIView的层介绍

UIView的层介绍

subview在西安市到屏幕上时。是位于superview上层的。

同一个view的subview时依照增加的顺序显示相应层的。越晚增加的subview显示在越上层。反之也是如此。

用superview能够直接管理subview的层。

-(void)insertSubview:(UIView *)view atIndex:(NSInteger)index;
//插入一个view到特定层

-(void)exchangeSubviewAtIndex:(NSInteger)index1 withSubviewAtIndex:(NSInteger)index2;
//交换两个层的view

-(void)insertSubview:(UIView *)view belowSubview:(UIView *)siblingSubview;
//插入一个view到某一个view的下层

-(void)insertSubview:(UIView *)view aboveSubview:(UIView *)siblingSubview;
//插入一个view到某一个view的下层

-(void)bringSubviewToFront:(UIView *)view;
//将某一个view放在最上层

-(void)sendSubviewToBack:(UIView *)view;
//将某一个view放在最下层

-(void)addSubview:(UIView *)view;
//加入一个view

原文地址:https://www.cnblogs.com/blfbuaa/p/6923539.html