我正在尝试使用for for循环创建多个UIView
代码:
view = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 50, 40)];
view = [[UIView alloc] initWithFrame:CGRectMake(200, 200, 50, 40)];
view = [[UIView alloc] initWithFrame:CGRectMake(50, 50, 50, 40)];
答案 0 :(得分:0)
以下是以编程方式
创建UIView
的示例
UIView *popup=[[UIView alloc]init];
popup.frame=CGRectMake(0,0, self.view.frame.size.width/2, self.view.frame.size.height/3);
popup.center = self.view.center;
popup.backgroundColor=[UIColor orangeColor];
[self.view addSubview:popup];
您可以根据需要更改X,Y,宽度,高度。