How to generate buttons using a for loop in ipad application?
I would like to generate buttons using a for loop.
Something like this:
button[] button = new button[10];
for(i=0;i<20;i++)
{
button[i].text = "some text";
}
Could someone please su开发者_如何学Goggest a way to do this?
for (int i=0; i < 20; i++) {
UIButton *button = [UIButton buttonWithType:...];
button.frame = CGRectMake(...);
[self.view addSubview:button];
}
精彩评论