这样根据数据信息,动态创建了一堆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的值
千巷猫影
呼唤远方
随时随地看视频慕课网APP
相关分类