[绍棠_Swift] Swift3.0中 通过viewController push跳转到TabbarController 隐藏后退按钮问题

来源:互联网 发布:win10如何更新软件 编辑:程序博客网 时间:2024/06/01 08:10

 直接设置隐藏代码会是无效的

let leftBtn:UIBarButtonItem = UIBarButtonItem.init()

        leftBtn.title =""

        let appDelegate:AppDelegate = UIApplication.shared.delegateas! AppDelegate

        appDelegate.navControl?.navigationItem.backBarButtonItem = leftBtn

        self.navigationItem.backBarButtonItem = leftBtn

        appDelegate.navControl?.navigationItem.hidesBackButton = true

解决方案如下

方法一:


    @objcfileprivatefunc loginBtnAction(sender:UIButton) {

        let bYTabBar =BYMainTabBarController()

//        self.present(bYTabBar, animated: true, completion: nil)

        bYTabBar.navigationItem.hidesBackButton=true

        self.navigationController?.pushViewController(bYTabBar, animated: true)

}


方法二:

在自定义的UITabbarController中添加  

self.navigationItem.hidesBackButton =true





阅读全文
0 0