Getting the Tail Truncated Version of a String

Most of the iOS controls have the option to tail truncate a string with an ellipsis on the end. You can even get this same functionality when drawing a string yourself. However, there doesn’t seem to be a way to get the tail truncated version as an NSString.

iOS Developer Tips has a nice little category do get exactly that. It allows you to specify the width and font used and will return you the truncated version. Very handy! The code for it is located here.

Advertisements

Posted on October 31, 2011, in Code and tagged , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: