怎么在IBAction中读取UITextField
的值?UITextField
是通过编程创建的,所以不能在XCode设置@property
和@synthesize
。 我的UITextField
生成文件如下:
for(i=0; i<[fieldName count]; i++)
{
UITextField *name= [fieldName objectAtIndex:i];
frame= CGRectMake(fromLeft, fromTop, totalWidth, totalHeight);
name= [[[UITextField alloc] initWithFrame:frame] autorelease];
name.borderStyle= UITextBorderStyleRoundedRect;
name.returnKeyType= UIReturnKeyDone;
//name.placeholder = [fieldName objectAtIndex:i]; \
name.autocapitalizationType= UITextAutocapitalizationTypeWords;
name.adjustsFontSizeToFitWidth= TRUE;
name.keyboardType= UIKeyboardTypeDefault;
[name addTarget:self action:@selector(doneEditing:)
forControlEvents:UIControlEventEditingDidEndOnExit];
[scroller addSubview:name];
fromTop= fromTop+ 40;
}
我想问的是,怎么实现点击按钮(IBAction)就能读取各个TextBox的值?先谢过了