我使用以下代码展示我的 View Controller :
UINavigationController* navigation = [[UINavigationController alloc] initWithRootViewController:sessionController];
[self presentViewController:navigation animated:YES completion:^{
}];
在我提供的 View Controller 的“viewDidLoad”方法中,我尝试按如下方式设置“后退按钮”:
UIBarButtonItem *newBackButton =
[[UIBarButtonItem alloc] initWithTitle:@"Test"
style:UIBarButtonItemStyleBordered
target:nil
action:nil];
[self.navigationController.navigationItem setBackBarButtonItem:newBackButton];
静默失败,没有异常,没有日志,没有错误,没有按钮。任何想法将不胜感激!
最佳答案
您可以尝试:
self.navigationItem.leftBarButtonItem = newBackButton
关于ios - 无法在 UINavigationController 上设置后退按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54899837/