2

When large Titles are enabled, the Heading of the View is always centered when the Title is in the "small" state. How do I change that?

I can't set a custom UILabel as the titleView because the large title would be affected as well with this approach.

So I tried this:

let paragraph = NSMutableParagraphStyle()
paragraph.alignment = .left
let attributes = [NSAttributedStringKey.foregroundColor:UIColor.black,
                  NSAttributedStringKey.paragraphStyle:paragraph]
self.navigationBar.titleTextAttributes = attributes

But this, unfortunately, does not affect the alignment of the title in its small state at all. (Color change works)

pacification
  • 5,838
  • 4
  • 29
  • 51
Noodledew
  • 509
  • 4
  • 19
  • Duplicate: https://stackoverflow.com/questions/44506238/how-do-i-left-align-the-title-of-a-navigation-bar-in-xcode – ValW Aug 31 '18 at 10:16
  • It's not a duplicate. Your linked question has nothing to do with large titles. – Noodledew Aug 31 '18 at 11:24

1 Answers1

-3

Inside view did load, create a UILabel with desired attributes. then set teh navigation left bar button item like this

self.navigationItem.leftBarButtonItem = UIBarButtonItem(customView: myLabel)
SUMIT NIHALANI
  • 387
  • 1
  • 10