我想从3个不同的Uitextfields中获取3个不同的值,然后将它们保存到1个字符串中,并通过按钮操作将其发送到其他API服务器。我很担心如何从3个UItextfield获得所有3个文本输入。任何想法?我的文本字段是帐户,用户名,密码。当使用将3个UItextfields中的数据分配到3个不同的字符串中
UITextField *account = [[UITextField alloc] initWithFrame:CGRectMake(90, 50, 140, 30)];
account.borderStyle = UITextBorderStyleRoundedRect;
account.font = [UIFont systemFontOfSize:14];
account.placeholder = @"Account";
account.autocorrectionType = UITextAutocorrectionTypeNo;
account.keyboardType = UIKeyboardTypeDefault;
account.returnKeyType = UIReturnKeyDone;
account.clearButtonMode = UITextFieldViewModeWhileEditing;
account.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
account.delegate = self;
[self.view addSubview:account];
[account release];
UITextField *username = [[UITextField alloc] initWithFrame:CGRectMake(90, 80, 140, 30)];
username.borderStyle = UITextBorderStyleRoundedRect;
username.font = [UIFont systemFontOfSize:14];
username.placeholder = @"User ID";
username.autocorrectionType = UITextAutocorrectionTypeNo;
username.keyboardType = UIKeyboardTypeDefault;
username.returnKeyType = UIReturnKeyDone;
username.clearButtonMode = UITextFieldViewModeWhileEditing;
username.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
username.delegate = self;
[self.view addSubview:username];
[username release];
UITextField *password = [[UITextField alloc] initWithFrame:CGRectMake(90, 110, 140, 30)];
password.borderStyle = UITextBorderStyleRoundedRect;
password.font = [UIFont systemFontOfSize:14];
password.placeholder = @"Password";
password.autocorrectionType = UITextAutocorrectionTypeNo;
password.keyboardType = UIKeyboardTypeDefault;
password.secureTextEntry = YES;
password.returnKeyType = UIReturnKeyDone;
password.clearButtonMode = UITextFieldViewModeWhileEditing;
password.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
password.delegate = self;
[self.view addSubview:password];
[password release];
找不到离开让所有3个DATAS:
-(void) textFieldDidEndEditing:(UITextField *)textField
功能。
在此先感谢!
还有一个小问题。施加的方法或甚至新矿的哪个invovles这个代码后: - (无效)textFieldDidEndEditing:(的UITextField *)的TextField { 开关(textField.tag){ 壳体1: 字符串1 =的TextField.text; 休息;案例2: string2 = textField.text; 休息;案例3: string3 = textField.text; 休息; 默认值: break; } } 我只获取帐户和用户名的值..任何想法? –
从来没有我发现它是一个小错误:)感谢很多人在这你的帮助! –