backIndicatorImage无法与setViewControllers()结合使用

时间:2018-07-17 20:59:00

标签: ios swift

我正在如下设置AppDelegate中的自定义后退箭头

    let backButtonImage = UIImage(named:"ic-arrow-left")?.withRenderingMode(UIImageRenderingMode.alwaysOriginal);
    let navigationBarAppearance = UINavigationBar.appearance();
    navigationBarAppearance.backIndicatorImage = backButtonImage;
    navigationBarAppearance.backIndicatorTransitionMaskImage = backButtonImage;

这按预期工作。但是现在我需要一次推送两个视图控制器,因此我正在使用以下方法做到这一点:

    var controllers = self.navigationController?.viewControllers
    controllers?.append(firstVC)
    controllers?.append(secondVC)
    self.navigationController?.setViewControllers(controllers!, animated: true)

结果是,当显示secondVC时,我的背面图像也显示出来,但旁边还有单词“ Back”(如果我注释掉firstVC的附加,则不会出现)

0 个答案:

没有答案