https://github.com/srcshelton/gentoo-ebuilds
That is all.
https://github.com/srcshelton/gentoo-ebuilds
That is all.
Sometimes, it’s the simple things which can be the most handy. Here’s a quick category on NSString to allow all characters within a set ([cc lang=”objc” inline=”true” width=”0″ theme=”geshi”]NSCharacterSet *illegalCharacterSet[/cc] or [cc lang=”objc” inline=”true” width=”0″ theme=”geshi”]NSCharacterSet *symbolCharacterSet[/cc], say) to be easily and efficiently removed. This fills a gap in between the [cc lang=”objc” inline=”true” width=”0″ theme=”geshi”]stringByTrimmingCharactersInSet:[/cc] and [cc lang=”objc” inline=”true” width=”0″ theme=”geshi”]stringByReplacingCharactersInRange: withString:[/cc] & [cc lang=”objc” inline=”true” width=”0″ theme=”geshi”]stringByReplacingOccurrencesOfString: withString:[/cc] methods, which only act upon the ends of the receiver or require a continuous range or fixed string respectively.
So far as I can tell, the iPhone SDK exposes no method to truncate an NSString to a given width (in pixels). This function obviously exists since it is used when drawing UILabels, and you can even draw truncated text with the method:
[cc lang=”objc” inline=”true” width=”0″ theme=”geshi”]
– (CGSize)drawInRect:(CGRect)rect withFont:(UIFont*)font lineBreakMode:(UILineBreakMode)lineBreakMode[/cc]
… but there’s no way to read-back the rendered text.
A quick search of the ‘net revealed some methods which would truncate a string based on the number of characters, but nothing to perform the operation based on the rendered width in pixels.