Chicken Chicken - 3 months ago 27
Objective-C Question

How to stop UIBarButtonItem text from truncating?

I have a

UIBarButtonItem
in a Navigation Bar with the text title "Save". When I transition to a fullscreen
UIPopoverController
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

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.

Comments