I am using navigation controller, and I've set to true its navigation bar's prefersLargeTitle
property. Everything works fine, but when the text of my title becomes too big, it doesn't fit in space. Here how it looks:
Is it possible to somehow make the title (while the navigation bar's prefersLargeTitle
property is set to true) dynamically adjust its font size, and if it is so, how to achieve that?
It's valid only in Interface Builder. but you CAN use it in runtime.
source link
This question is somewhat answered here: How to resize Title in a navigation bar dynamically.
That being said, this is slightly different, in that you have the prefersLargeTitle property set. Now, I am not sure whether the
tlabel.adjustsFontSizeToFitWidth = true
overrides theprefersLargeTitle
property, but try it out and see if it works. There is also some additional information regarding navigation item large titles here: https://developer.apple.com/documentation/uikit/uinavigationitem/2909056-largetitledisplaymode. Hope this helps.This is the workaround that I found