后退按钮没有出现在按下的UIViewController上

She*_*lam 10 cocoa-touch objective-c uitableview uiviewcontroller ios

我有一个UITableViewController.当我点击一个单元格时,我想推送一个新视图.这工作正常,但新视图没有后退按钮.为什么是这样?

TableViewCode:

if([[NSUserDefaults standardUserDefaults] boolForKey:@"isLoggedIn"])
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    ProfileViewController* profileViewController = [[ProfileViewController alloc] initWithNibName:@"ProfileViewController" bundle:nil];
    profileViewController.message = [NSDictionary dictionaryWithObjectsAndKeys:cell.textLabel.text, @"user_login", @"default", @"message_source", nil];
    switch(indexPath.row) {
        case kUsernameRow:                  
            [self.navigationController pushViewController:profileViewController animated:YES];
            [profileViewController release];
            break;
        case kAboutRow:                 
            break;
        case kTOSRow:                   
            break;
    }
}
Run Code Online (Sandbox Code Playgroud)

Fil*_*lic 14

如果您的表视图控制器是从nib创建的,则其默认标题为@""(注意:不是nil,但是为空字符串).

如果导航堆栈上的前一个控制器的标题是空字符串,则后退按钮有一个错误,因此在表视图控制器中,您需要将标题设置为nil代码中的一个或一些字符串,或者在Interface Builder中设置一些字符串(不能把它设置在nil那里).