1

When hiding and later unhiding the backButton (not a regular left/rightBarButtonItem) in the NavigationBar via navigationItem.hidesBackButton = true/false the text gets truncated in the middle.

Set the Text Size (dynamic font size) of your phone to the smallest value (or second smallest) otherwise it doesn't work.

Example: The back button shows the title of the previous controller, e.g. < Settings. After hiding and showing it the back button again it now says < Se...gs

Is there any known workaround?

benrudhart
  • 1,406
  • 2
  • 13
  • 25
  • Does this answer your question? [How to stop UIBarButtonItem text from truncating?](https://stackoverflow.com/questions/39144390/how-to-stop-uibarbuttonitem-text-from-truncating) – Amr Sep 08 '21 at 11:24
  • Unfortunately not as the issue is not related to UIBarButtonItems that I create but are created by the system (the back button item). – benrudhart Sep 08 '21 at 11:40
  • Oh, sorry! Check if this will help: https://stackoverflow.com/a/11600948/11974184 – Amr Sep 08 '21 at 11:43
  • 1
    Maybe try setNeedsDisplay() after unhiding or setting the text again? – Tofu Warrior Sep 08 '21 at 15:19
  • Thank you @TofuWarrior it does fix the issue! I have this issue in many places in one app and am wondering if a general fix that could be applied only once in the app does exist? – benrudhart Sep 09 '21 at 07:36
  • @benrudhart I'm facing the exact same issue, I couldn't figure out on which view did you call setNeedsDisplay() to fix the issue? – A. Abdelmonsef May 24 '22 at 18:54
  • Unfortunately I don't know anymore. I guess I'd try on the viewController owning the BarButtons or on it's navigationController – benrudhart May 25 '22 at 05:43

0 Answers0