Chicken Chicken -4 years ago 357
Objective-C Question

How to stop UIBarButtonItem text from truncating?

I have a

in a Navigation Bar with the text title "Save". When I transition to a fullscreen
and then dismiss it, the text in my UIBarButtonItem gets truncated to "S..e". For all other segues and views I have no problem when returning.

I've tried manually changing the width and setting "possibleTitles" to include long words but I can't stop the truncation.

I'm using a custom font if that makes a difference.

Answer Source

Try to init your UIBarButtonItem with a custom view.

[[UIBarButtonItem alloc] initWithCustomView:yourView];

Just make sure your custom view has the right frame (e.g. for an UILabel ,wide enough to not truncate its content). Things should work fine.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download