I just changed the font of the back button while using large titles in the navigation bar. This worked fine, but then I had the problem that the transition/animation of the small back button text to the large title of the previous page looked pretty weird. The large title appeared a second time with a kind of fade-in effect at the top left corner of the view controller. So how can I prevent this strange behavior?
Asked
Active
Viewed 487 times
1 Answers
3
I could solve this problem on my own, but since I could not find a similar topic/problem/solution on the web I wanted to share the solution, just in case someone else has the same problem one day.
To solve this strange behavior I had to set the custom font for the normal UIControlState and additionally for the highlighted one.
UIBarButtonItem.appearance().setTitleTextAttributes([kCTFontAttributeName as NSAttributedStringKey: UIFont(name: "Futura", size: 17)!], for: .normal)
UIBarButtonItem.appearance().setTitleTextAttributes([kCTFontAttributeName as NSAttributedStringKey: UIFont(name: "Futura", size: 17)!], for: .highlighted)
Hope this helps! :)

Mitemmetim
- 520
- 3
- 12
-
Just wanted to say this saved me after hours of being unable to figure out why the back animation was glitchy. Setting .highlighted did the trick. Thank you! – Ali Parr Jun 04 '19 at 12:54
-
No problem, great to hear that I could help you! :) – Mitemmetim Jun 04 '19 at 15:40