UIView的定义
UIView *view=[[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
UIView的常用属性
- 背景颜色: view.backgroundColor=[UIColor redColor];
- 透明度:view.alpha=0.5;
- 是否隐藏:view.hidden=YES;
- 中心点:view.center=self.view.center;
- tag(标签)值:view.tag=10;
- 根据tag找view:[self.view viewWithTag:10]
- 父视图将一个子视图移动到前面:[self.view bringSubviewToFront:view]
- 父视图将一个子视图移动到后面:[self.view sendSubviewToBack:view]
- 将自己从父视图中移除:[view removeFromSuperview];