UIButton *button1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button1.frame = CGRectMake(100+tag+20, 80, 100, 60);
[self.OneGroupUnitView addSubview:button1];我单独的向一个view里添加button是没有错的
问题是我现在要在一个循环里动态生成很多个button
我如果这样定义的话每一个button1的名字不都一样了么,所以最后只显示一个?
求教大神,这个问题如何解决?
button1.frame = CGRectMake(100+tag+20, 80, 100, 60);
[self.OneGroupUnitView addSubview:button1];我单独的向一个view里添加button是没有错的
问题是我现在要在一个循环里动态生成很多个button
我如果这样定义的话每一个button1的名字不都一样了么,所以最后只显示一个?
求教大神,这个问题如何解决?
把
{
UIButton *button1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button1.frame = CGRectMake(100+tag+20, 80, 100, 60);
[self.OneGroupUnitView addSubview:button1];
}
这段 代码放到循环体里面。