我正在尝试创建一个将字符串对象“tableColorName”更改为所选单元格的方法。tableDataNSArray由对象组成:“red”、“blue”、“green”。redColor如果选择红色,blueColor如果选择蓝色,如果选择绿色,我想将字符串“tableColorName”保存到greenColor。选择单元格后,我希望 viewController 返回根目录。我提前感谢您的帮助:
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
int theRow = indexPath.row;
NSString *tableColorName;
tableColorName = [[NSString alloc] initWithString:([_tableData [theRow] stringValue],@"Color")];
[self.navigationController popToRootViewControllerAnimated:YES];
}