0
extension UINavigationItem {
        func setTitle(title:String) {
            let label = UILabel()
            label.font = UIFont(name: "HelveticaNeue-Medium", size: 16)
            label.backgroundColor = .clear
            label.numberOfLines = 2
            label.textAlignment = .center
            label.textColor = UIColor(hex: "4E4E4E")
            label.text = title
            self.titleView = label
        }
    }

I have used the above code for displaying multiline label in navigation bar but it won't work on iPhone 6s+ particularly the label is cropped at the end (single line is displayed). which runs on 11.4.1. I also have iPhone 7 which runs on 11.4 which does not have problem to display the multiline label. only thing is iPhone 6s+. Could you please correct me if I missed anything

I tried steps explained here too Multiline Navigationbar Title enter image description here enter image description here

Srini
  • 387
  • 1
  • 13
  • 27

0 Answers0