0
NEXT 단추가있는 키보드의 첫 번째 텍스트 입력을 클릭 할 때 원하는 등록 양식으로 사용하는 UITableView
이 있습니다. 나는 무언가를 시도했지만 그것은 항상 을 표시하고 버튼을 클릭하면 마지막 텍스트 입력으로 이동합니다. :다음 단추가 표시되지 않습니다
- (UITableViewCell *)tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *kCellIdentifier = @"Cell";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:kCellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:kCellIdentifier];
cell.accessoryType = UITableViewCellAccessoryNone;
if ([indexPath section] == 0) {
playerTextField = [[UITextField alloc] initWithFrame:CGRectMake(110, 10, 185, 30)];
playerTextField.adjustsFontSizeToFitWidth = YES;
playerTextField.textColor = [UIColor blackColor];
if ([indexPath row] == 0) {
playerTextField.placeholder = @"Required";
playerTextField.keyboardType = UIKeyboardTypeDefault;
playerTextField.returnKeyType = UIReturnKeyDone;
playerTextField.tag = 3;
}
else if([indexPath row] == 1){
playerTextField.placeholder = @"Required";
playerTextField.keyboardType = UIKeyboardTypeDefault;
playerTextField.returnKeyType = UIReturnKeyDone;
playerTextField.tag = 4;
}
else if([indexPath row] == 2){
playerTextField.placeholder = @"[email protected]";
playerTextField.keyboardType = UIKeyboardTypeEmailAddress;
playerTextField.returnKeyType = UIReturnKeyNext;
playerTextField.tag = 1;
}
else {
playerTextField.placeholder = @"password";
playerTextField.keyboardType = UIKeyboardTypeDefault;
playerTextField.returnKeyType = UIReturnKeyDone;
playerTextField.secureTextEntry = YES;
playerTextField.tag = 2;
}
playerTextField.backgroundColor = [UIColor whiteColor];
playerTextField.autocorrectionType = UITextAutocorrectionTypeNo;
playerTextField.autocapitalizationType = UITextAutocapitalizationTypeNone;
playerTextField.textAlignment = NSTextAlignmentLeft;
playerTextField.delegate = self;
playerTextField.clearButtonMode = UITextFieldViewModeNever;
[playerTextField setEnabled: YES];
playerTextField.backgroundColor = [UIColor clearColor];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
[cell addSubview:playerTextField];
}
}
if ([indexPath section] == 0) { // Email & Password Section
if ([indexPath row] == 0) { // Email
cell.textLabel.text = @"First Name";
}
else if ([indexPath row] == 1) { // Email
cell.textLabel.text = @"Last Name";
}
else if([indexPath row] == 2){
cell.textLabel.text = @"Email";
}
else {
cell.textLabel.text = @"Password";
}
}
return cell;
}
...
-(BOOL) textFieldShouldReturn:(UITextField *)textField{
if(textField.tag == 3) {
[playerTextField becomeFirstResponder];
}else if(textField.tag == 4) {
[playerTextField becomeFirstResponder];
}else if(textField.tag == 1) {
[playerTextField becomeFirstResponder];
} else if(textField.tag == 2) {
[playerTextField resignFirstResponder];
}
return NO;
}
중복 다음 텍스트 필드로 이동합니다 //stackoverflow.com/questions/1347779/how-to-navigate-through-textfields-next-done-buttons – iOS