Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iPhone master detail app如何使用detail view更改主视图中相应单元格中显示的文本值_Iphone_Ios_Uitableview - Fatal编程技术网

iPhone master detail app如何使用detail view更改主视图中相应单元格中显示的文本值

iPhone master detail app如何使用detail view更改主视图中相应单元格中显示的文本值,iphone,ios,uitableview,Iphone,Ios,Uitableview,我是iOS编程的新手,目前正在学校上iOS课程。对于我正在做的一个项目,我们必须为iPhone编写一个基本的主细节应用程序。对于我的应用程序,我正在创建一个简单的待办事项列表类型的应用程序。每个任务的名称显示在主视图中,任务的名称可以在详细视图中更改。我设置了一个“保存”按钮,按下该按钮时会有一个“展开序列”代理。当我按下按钮时,我返回到主视图,我无法获得要实时更改的相应单元格的值。我知道主视图正在将更改的信息取回,因为更改的信息只有在控件转移回主视图并将其保存后才能保存。当我重新运行应用程序时

我是iOS编程的新手,目前正在学校上iOS课程。对于我正在做的一个项目,我们必须为iPhone编写一个基本的主细节应用程序。对于我的应用程序,我正在创建一个简单的待办事项列表类型的应用程序。每个任务的名称显示在主视图中,任务的名称可以在详细视图中更改。我设置了一个“保存”按钮,按下该按钮时会有一个“展开序列”代理。当我按下按钮时,我返回到主视图,我无法获得要实时更改的相应单元格的值。我知道主视图正在将更改的信息取回,因为更改的信息只有在控件转移回主视图并将其保存后才能保存。当我重新运行应用程序时,将显示新名称而不是默认名称

这是放松阶段的代表

- (IBAction) done:(UIStoryboardSegue *)segue
{
// index for the cell in the master view table that was changed
NSIndexPath *changeIndex = [self.tableView indexPathForSelectedRow];

[self tableView:self.tableView cellForRowAtIndexPath:changeIndex];

// place the new dictionary entry created by the detail view in the location of the
// array where the old entry was located
_taskList[changeIndex.row] = self.ChangedEntry;

// store the change in the plist file
[_taskList writeToFile:self->documentPlistPath atomically:YES];
}
它调用了这个函数,它似乎改变了表中某个单元格的文本,但我不确定

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:  (NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
cell.textLabel.text = _taskList[indexPath.row][TASK_DATA_NAME];
return cell;
}

所以,是的,我只是想弄清楚如何让主视图反映在细节视图中所做的更改,而不必关闭应用程序并重新打开它。哦,我使用的是Xcode 5,目标是iOS 7。

基本上,在更新数据模型(
\u taskList
)后,需要通过调用
重新加载数据来刷新表视图。这告诉它更新所有行。

嘿,非常感谢。这是我需要为我的项目弄清楚的最后一件事之一。谢谢