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];
本文详细介绍了UIView的基本用法,包括创建UIView实例、设置背景颜色、调整透明度、隐藏显示视图、定位中心点、使用tag属性查找视图以及如何在父视图中调整子视图的位置等。
691

被折叠的 条评论
为什么被折叠?



