gpt4 book ai didi

iphone - 下一步按钮不显示

转载 作者:行者123 更新时间:2023-11-28 20:14:22 24 4
gpt4 key购买 nike

我有一个 UITableView,当我单击键盘上的第一个文本输入以具有 NEXT 按钮时,我将其用作注册表单。我已经尝试了一些东西,但它总是显示 DONE 按钮,点击它会将我移至上次文本输入

- (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 = @"example@gmail.com";
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;
}

最佳答案

改变这个

     playerTextField.returnKeyType = UIReturnKeyDone;

     playerTextField.returnKeyType = UIReturnKeyNext; 

链接中的其余代码->“在评论中”移动到下一个文本字段

关于iphone - 下一步按钮不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18633332/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com