我正在以UIButtons
编程方式创建,然后将它们存储UIButtons
在NSMutableArray
. 所有这些UIButtons
都有一些文本作为标题。我没有这些的出口UIButtons
。现在我想在我触摸或单击某些时分配UIButton
to的标题。但对我来说问题是这样的:我怎样才能在这些. 因为我以编程方式创建,而且这些也没有插座。这是我创建按钮的代码:UIlabel
UIButton
UIButtons
UIButtons
UIButtons
saveBtn = [[NSMutableArray alloc] init];
for (int i=0; i<30; i++) {
if (btnn>8) {
UIButton *btn = [UIButton
buttonWithType:UIButtonTypeRoundedRect];
btn.frame = CGRectMake(200.0 , spacey, 30.0, 30.0);
int idx;
idx = arc4random()%[arr count];
NSString* titre1 = [arr objectAtIndex:idx];
[btn setTitle:titre1 forState:UIControlStateNormal];
spacey=spacey+30;
spacex = 80;
btnn = 0;
}
else {
btnn++ ;
UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn.frame = CGRectMake(spacex, spacey, 30.0, 30.0);
int idx;
idx = arc4random()%[arr count];
NSString* titre1 = [arr objectAtIndex:idx];
[btn setTitle:titre1 forState:UIControlStateNormal];
spacex = spacex + 30;
[saveBtn addObject:btn];
[self.view addSubview:btn];
}
}
请任何人都可以指导我如何为这些执行操作NSMutableArray
UIButtons
。