无法在 UINavigationController 上设置后退按钮

Unable to set back button on UINavigationController

我将使用以下代码展示我的视图控制器:

UINavigationController* navigation = [[UINavigationController alloc] initWithRootViewController:sessionController];
[self presentViewController:navigation animated:YES completion:^{
}];

在我呈现的视图控制器的 "viewDidLoad" 方法中,我试图按如下方式设置 "back button":

UIBarButtonItem *newBackButton =
[[UIBarButtonItem alloc] initWithTitle:@"Test"
                                 style:UIBarButtonItemStyleBordered
                                target:nil
                                action:nil];
[self.navigationController.navigationItem setBackBarButtonItem:newBackButton];

静默失败,无异常,无日志,无错误,无按钮。如有任何想法,我们将不胜感激!

你可以试试:

self.navigationItem.leftBarButtonItem = newBackButton