Ios 将文本从UItableViewcell选择传递到UItextfield

Ios 将文本从UItableViewcell选择传递到UItextfield,ios,uitableview,uitextfield,Ios,Uitableview,Uitextfield,我正在尝试将文本从UITableViewCell选择传递到UITextField 我的didselectrowatinex设置如下 #pragma mark -- select row - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *selectedCell = [tableView cellForRowAtIn

我正在尝试将文本从
UITableViewCell
选择传递到
UITextField

我的
didselectrowatinex
设置如下

#pragma mark -- select row
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath];

    NSLog(@"%@", selectedCell.textLabel.text);// shows correct values

    currentSelected.text = selectedCell.textLabel.text; // currentSelected is defined below


    [tableView deselectRowAtIndexPath:indexPath animated:YES];

}
这是我的表视图选择,正如您所看到的,我正试图将文本传递给currentSelected
UITextField
,但是什么也没有发生

这是我如何设置当前选定的

#pragma mark - TextField delegates
- (void)textFieldDidBeginEditing:(UITextField *)textField {

    currentSelected = textField;

}

将字符串保存到视图控制器的属性中,而不是保存到文本字段中

然后,在属性中包含文本后,如果需要,可以将其显示在文本字段中

我猜在didSelectRowAtIndexPath中,currentSelected为零

#pragma mark - TextField delegates
- (void)textFieldDidBeginEditing:(UITextField *)textField {

    currentSelected = textField;

}
替换为以下方法,并确保已清除textfield委托

#pragma mark - TextField delegates
- (void)textFieldDidEndEditing:(UITextField *)textField {

    currentSelected.text = textField.text;

}

谢谢你的评论,我已经做了更多的工作,现在我得到了TestField的新值,应该返回我试图设置新文本的位置,但它甚至没有显示出来。任何示例都将不胜感激。@HurkNburkS,你需要什么样的示例?您不知道如何将字符串从一个控制器传递到下一个控制器吗?这给了我一个警告:从“NSString*”分配给“UITextField*”的指针类型不兼容“抱歉..”。。textfielddidediting方法