How to hide back title of the navigation in iOS11

11/6/2018 The lastest way

It is the best way to hide left back title of the navigation bar so far.

class YGCustomNavigationVC: UINavigationController {
    override func viewDidLoad() {
        super.viewDidLoad()
        self.delegate = self
    }
}

extension YGCustomNaviVC:UINavigationControllerDelegate {
    func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
        let item = UIBarButtonItem(title: " ", style: .plain, target: nil, action: nil)
        viewController.navigationItem.backBarButtonItem = item
    }
}

6/5/2018更新

iOS 全局修改UINavigationBar的返回按钮(适配 iOS 11)

This way is no pefect when A viewcontroller which has hidden navigation bar push to B viewcontroller which will show it.
It won't hide left back title of the navigation bar in iOS11

3/2/2018更新

The following code do work perfectly before iOS11, If you want hide back title of the navigation bar.

UIBarButtonItem.appearance()
.setBackButtonTitlePositionAdjustment(UIOffsetMake(0,-300),  for:UIBarMetrics.default)
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,448评论 0 10
  • The Inner Game of Tennis W Timothy Gallwey Jonathan Cape ...
    网事_79a3阅读 12,285评论 3 20
  • 我相信,每个人都有过授权和授权的经历,至少小时侯你妈妈叫你去买过一瓶酱油,也可能叫小妹妹去买过一盒火柴. 关于火柴...
    陈之平阅读 1,018评论 0 1
  • 乱茎丝丝过重门,红泥点点恋玉盆。 初秋细叶青黄间,夜雨梧桐总忆魂。 落瓣残收埋作冢,西风一梦了无痕。 而今踩碎团圆...
    幽小窗阅读 324评论 71 57
  • 爸爸买了一盒花生酱 晚饭我们就吃了起来 吃过饭后 我玩我的小苹果 爸爸也玩他的苹果 妈妈呢还在吃着花生酱 用我的小...
    素者如是阅读 149评论 0 0