How to remove all navigationbar back button title

后端 未结 30 3439
后悔当初
后悔当初 2020-12-12 15:42

When I push a UIViewController, it has some title in back button at new UIViewController, if the title has a lot of text, It does not look good in

30条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-12 15:56

    Works for Swift 4.2

    Using the line of code in AppDelegate file into didFinishLaunchingWithOptions

        UIBarButtonItem.appearance(whenContainedInInstancesOf: [UINavigationBar.self]).setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.clear], for: .normal)
    
        UIBarButtonItem.appearance(whenContainedInInstancesOf: [UINavigationBar.self]).setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.clear], for: .highlighted)
    

提交回复
热议问题