Truncating UIActionSheet labels
Truncating UIActionSheet labels
- Subject: Truncating UIActionSheet labels
- From: Fritz Anderson <email@hidden>
- Date: Tue, 27 Jul 2010 18:07:33 -0500
iOS 3.2 (iPad)
I want to present a UIActionSheet on an iPad. The label strings for the choices are dynamically constructed. The strings may be wider than the buttons, and tail truncation isn't good — the distinct parts are mostly at the end.
Is there any way to get middle truncation into the labels in a UIActionSheet? The obvious way is to truncate the strings myself before putting them into the sheet, but it looks as though I'd have to do that myself, and I won't get it right for the display width. The string-drawing category of NSString will let you _measure_ or _draw_ a truncated string, but you can't get the truncated string back. I suppose one could iterate trial truncations until I find one that fits, but it seems inelegant.
A nice way to do it would be to set some sort of property in the sheet or its buttons, in the willPresentActionSheet: delegate method if necessary. There seems to be no hook for that, other than iterating the sheet's subviews for UIButtons and setting the truncationMode of the respective labels. This doesn't sound like a winning bet for future compatibility.
Ideas, please?
— F
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden