ios动态创建UIView
时间:2014-06-09 14:54:00
收藏:0
阅读:393
- (id)initWithFrame:(CGRect)frame; // default initializer
// (CGRect)frame:UIView的大小
创建一个UIView
- (void)viewDidLoad { UIView *v = [[UIView alloc]initWithFrame:CGRectMake(10, 50, 300, 200)]; // 初始化一个UIView [v setBackgroundColor:[UIColor redColor]]; // 设置背景颜色 [self.view addSubview:v]; // 将创建的视图添加到当前视图中 // [UIButton] [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. }
评论(0)