因此,如果您的导航控制器没有条形按钮项目,则导航后退按钮将显示最后一个视图控制器的名称,我想保留它,因为我不想对其进行硬编码.我确实知道如何添加它但我不想这样做,因为这留
override func viewDidLoad() { super.viewDidLoad() let newBtn = UIBarButtonItem(title: "new", style: .plain, target: self, action: #selector(anotherMethod)) self.navigationItem.leftItemsSupplementBackButton = true self.navigationItem.leftBarButtonItem = newBtn//self.navigationItem.leftBarButtonItems = [newBtn,anotherBtn] }