简体   繁体   中英

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

I created iOS application from Navigation-based application template.
This snippet is from 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.

Upong clicking on a row, DotoViewController is getting displayed but without the back button to RootViewController on the left side.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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