//1.交换层次
//exchangeSubviewAtIndex根据索引交换子视图的位置索引从0开始第一个添加的索引为0
[self.window exchangeSubviewAtIndex:2 withSubviewAtIndex:1];
//2.插入一个视图
//创建绿色视图
UIView *greenView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 200, 200)];
greenView.backgroundColor= [UIColor greenColor];
//在某个子视图之上插入一个子视图
//[self.window insertSubview:greenView aboveSubview:_redView];
//在某个子视图之下插入一个子视图
//[self.window insertSubview:greenView belowSubview:_blueView];
//在索引视图之下
[self.window insertSubview:greenView atIndex:2];
//3.从前到后或者从后到前
//sendSubviewToBack把子视图送到最后面
//从前到后
//[self.window sendSubviewToBack:_blueView];
//[self.window bringSubviewToFront:_redView];
//4.从父视图上移除
//removeFromSuperview从父视图上移除
//[_redView removeFromSuperview];