开发者

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];
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜