简体   繁体   English

将控制器推入堆栈时,不会显示后退按钮

[英]Back button isn't getting displayed upon pushing a controller into the stack

I created iOS application from Navigation-based application template. 我从基于导航的应用程序模板创建了iOS应用程序
This snippet is from RootViewController.m: 这个片段来自RootViewController.m:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  DotoViewController *detailViewController = [[DotoViewController alloc] 
                             initWithNibName:@"DotoViewController" bundle:nil];
  NSManagedObject *selectedObject = [[self fetchedResultsController] 
                             objectAtIndexPath:indexPath];

  detailViewController.dotoObj = selectedObject;
  [self.navigationController pushViewController:detailViewController animated:YES];
  [detailViewController release];   
}

DotoViewController is a subclass of UIViewController and has an accompanying NIB file. DotoViewController是UIViewController的子类,并附带一个NIB文件。

Upong clicking on a row, DotoViewController is getting displayed but without the back button to RootViewController on the left side. Upong点击一行,DotoViewController正在显示,但没有返回按钮到左侧的RootViewController。

What I'm missing? 我错过了什么?

Perhaps your root view controller has an empty title? 也许您的根视图控制器有一个空标题? The view controller's title is used as the title for the back button, so if you have an empty string there, this can cause the back button to disappear. 视图控制器的标题用作后退按钮的标题,因此如果您有一个空字符串,这可能会导致后退按钮消失。 If it's nil, it should display the standard "Back" though. 如果它为零,则应显示标准“返回”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM