这样根据数据信息,动态创建了一堆UITextField,每一个UITextField都对应了一个UIButton。
for(i=0; i<[users count]; i++)
{
NSString *name = [users objectAtIndex:i];
UITextField *user = [[UITextField alloc] initWithFrame:CGRectMake(0.f, top, 200.f, 30.f)];
user.text = name;
user.returnKeyType = UIReturnKeyDone;
user.keyboardType = UIKeyboardTypeDefault;
UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(220.f, top, 80.f, 30.f)];
[btn addTarget:self action:@selector(clicked:) forControlEvents:UIControlEventTouchUpInside];
[self.scroller addSubview:user];
[self.scroller addSubview:btn];
top = top + 40;
}
现在要通过点击某个Button,修改对应的UITextField的值
之前都是把UITextField做成全局变量的,现在动态创建不能全局了,怎么办?