Although you say that the button labels are generated dynamically, does it really not make sense for you to generate the alert title and/or message strings dynamically and use static button labels (OK/Cancel, Yes/No, etc.)? Both of those fields are set up to resize to fit the strings. Otherwise it seems like you're fighting against the design of UIActionSheet.
On Jul 27, 2010, at 4:07 PM, Fritz Anderson wrote: > 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? _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
