按钮不会显示在navigationBar项目中

Sen*_*Lee 1 iphone uinavigationcontroller

我已经创建了一个基于导航的应用程序模板的项目,并做了一些工作并运行它.

我预计如果我触摸一个单元格,新的视图将显示,新的图标(返回按钮)也将显示在导航栏项目上.

但由于某种原因,"后退按钮"不会自动添加.可能是什么问题?

以下是我的代码.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    // Navigation logic may go here -- for example, create and push another view controller.
    MessageView *detailViewController = [[MessageView alloc] initWithNibName:@"MessageView" bundle:nil];

    NSDictionary* aMessage = [m_tableData objectAtIndex:indexPath.row];
    detailViewController.m_message = [[NSDictionary alloc] initWithDictionary:aMessage];

    // Pass the selected object to the new view controller.
    [self.navigationController pushViewController:detailViewController animated:YES];
    [detailViewController release];
}
Run Code Online (Sandbox Code Playgroud)

mac*_*rth 7

你可能没有给你的父控制器一个标题(在viewDidLoad或viewWillAppear中只是self.title = @"我的名字").这是默认情况下在后退按钮中填充的内容,因此如果您没有命名,则不会获得后退按钮.