Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/106.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.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
Ios uitableview+导航控制器从选定元素设置标题_Ios_Objective C_Xcode_Uitableview_Uinavigationcontroller - Fatal编程技术网

Ios uitableview+导航控制器从选定元素设置标题

Ios uitableview+导航控制器从选定元素设置标题,ios,objective-c,xcode,uitableview,uinavigationcontroller,Ios,Objective C,Xcode,Uitableview,Uinavigationcontroller,我有一个UINavigationController,它在UITableView中处理导航 当我从表中选择一行时,我需要在UINavigationController标题中显示上一菜单中的选定项 单元格的标签从填充UITableView行的外部xml读取 如何在UINavigationBar的标题上显示所选内容 我已经使用self.title命令设置了一个静态标题,但它不符合我的需要这对您有用吗 - (void)tableView:(UITableView *)tableView didSele

我有一个UINavigationController,它在UITableView中处理导航

当我从表中选择一行时,我需要在UINavigationController标题中显示上一菜单中的选定项

单元格的标签从填充UITableView行的外部xml读取

如何在UINavigationBar的标题上显示所选内容


我已经使用self.title命令设置了一个静态标题,但它不符合我的需要

这对您有用吗

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
{
    DetailTableViewController *detailController = [[DetailTableViewController alloc] initWithStyle:UITableViewStyleGrouped];
    //   Set the detail controller title to whatever you want here...
    detailController.title = @"Your title";

    //   Or set it to the title of this row
    UITableViewCell *cell = [[self tableView] cellForRowAtIndexPath:indexPath];
    detailController.title = cell.textLabel.text;

    [[self navigationController] pushViewController:detailController animated:YES];
}
通常,UINavigationController总是选择实际加载的UIViewController的标题。这就是为什么必须在viewDidLoad中定义它:


上面显示的方法似乎更具动态性…但这也很有效。

当我调用detailview时,它可以工作,但我的应用程序是这样工作的:Table1->Table2->Table3->detailview从Table3到detailview我没有问题,它非常像你建议的那样工作。我想将表1上的选择显示为表2中的标题等…对,代码示例是为了说明问题。从表1->表2到表2->表3的工作方式应该相同。在该层次结构中的每个UITableViewController子类中,可以以相同的方式填充下一个控制器的标题属性。已解决:这是coredata实体给出的问题。使用self.title=[selectedObject valueForKey:@name]解决;
self.title = @"Title";