self.view.backgroundColor=[UIColor orangeColor];
UIView *v1=[[UIView alloc]initWithFrame:CGRectMake(100, 100, 200, 200)];
v1.backgroundColor=[UIColor purpleColor];
[self.view addSubview:v1];
UIView *v2=[[UIView alloc]initWithFrame:CGRectMake(100, 100, 300, 100)];
v2.backgroundColor=[UIColor blackColor];
[self.view addSubview:v2];
UIView *v3=[[UIView alloc]initWithFrame:CGRectMake(100, 100, 50, 50)];
v3.backgroundColor=[UIColor redColor];
[self.view addSubview:v3];
//把v3添加到v1上面
[self.view insertSubview:v3 aboveSubview:v1];
//把v3插到v1下面
[self.view insertSubview:v3 belowSubview:v1];
//把v1带到最上层
[self.view bringSubviewToFront:v1];
//交换两个view
[self.view insertSubview:v2 atIndex:0];
[self.view insertSubview:v3 atIndex:1];
[self.view exchangeSubviewAtIndex:0 withSubviewAtIndex:1];
//发送到最底层
//缩放
myview.transform=CGAffineTransformScale(myview.transform, 0.8, 0.8);
//动画
[UIView animateWithDuration:7 animations:^{
// //旋转
myview.transform=CGAffineTransformRotate(myview.transform, M_PI_4);
}];
// //移动
[UIView animateWithDuration:7 animations:^{myview.transform=CGAffineTransformTranslate(myview.transform, 100, 400);}];