Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何在ipad应用程序中使用for循环生成按钮?_Iphone_Objective C_Cocoa Touch_Ipad - Fatal编程技术网

Iphone 如何在ipad应用程序中使用for循环生成按钮?

Iphone 如何在ipad应用程序中使用for循环生成按钮?,iphone,objective-c,cocoa-touch,ipad,Iphone,Objective C,Cocoa Touch,Ipad,我想使用for循环生成按钮 大概是这样的: button[] button = new button[10]; for(i=0;i<20;i++) { button[i].text = "some text"; } 按钮[]按钮=新按钮[10]; for(i=0;ifor(int i=0;i

我想使用for循环生成按钮

大概是这样的:

button[] button = new button[10];
for(i=0;i<20;i++)
{
button[i].text = "some text";
}
按钮[]按钮=新按钮[10];
for(i=0;i
for(int i=0;i<20;i++){
UIButton*button=[UIButton button类型:…];
button.frame=CGRectMake(…);
[self.view addSubview:按钮];
}
用于(int i=0;i<20;i++){
UIButton*button=[UIButton button类型:…];
button.frame=CGRectMake(…);
[self.view addSubview:按钮];
}

ok…它是意外添加的…ok…它是意外添加的。。。
for (int i=0; i < 20; i++) {
    UIButton *button = [UIButton buttonWithType:...];
    button.frame = CGRectMake(...);
    [self.view addSubview:button];
}