uiview 的方法
//定义3个view
UIView *view1 = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
view1.backgroundColor = [UIColor redColor];
[self.window addSubview:view1];
UIView *view2 = [[UIView alloc] initWithFrame:CGRectMake(120, 150, 100, 100)];
view2.backgroundColor = [UIColor yellowColor];
[self.window addSubview:view2];
UIView *view3 = [[UIView alloc] initWithFrame:CGRectMake(140, 200, 100, 100)];
view3.backgroundColor = [UIColor greenColor];
[self.window addSubview:view3];
//UIView添加视图的方法
//1.在指定的Index处插入子视图
[self.window insertSubview:view2 atIndex:0];
//2.在指定的视图上面添加子视图
[self.window insertSubview:view1 aboveSubview:view2];
//3.在指定的视图下⾯面添加⼦子视图
[self.window insertSubview:view3 belowSubview:view2];
//UIview 管理视图层次
//1.把指定的视图移动到最前面
[self.window bringSubviewToFront:view1];
//2.把指定的子视图移动到最后面
[self.window sendSubviewToBack:view2];
//3.交换两个指定索引位置子视图
[self.window exchangeSubviewAtIndex:0 withSubviewAtIndex:1];
//4.删除某个子视图
[view3 removeFromSuperview];
//UIView 视图属性
//1.hidden控制视图的显隐
view1.hidden = YES;
//2.alpha控制视图的透明度(0-1)
view1.alpha = 0.5;
//3.superview 获取本视图的父视图
UIView * superView = [view1 superview];
//调用父视图改变属性
superView.backgroundColor = [UIColor yellowColor];
//4.subviews 获取本视图的所有子视图 他取出来是以数组形式存放
NSArray * subview = [self.window subviews];
//调用子视图改变属性
((UIView*)subview[0]).backgroundColor = [UIColor grayColor];
//5.tag 给视图添加标记,被加完标记的视图可以使用viewWithTag:方法取出
view1.tag = 101;
UIView *view = [self.window viewWithTag:101];
view.alpha = 0.1;