On Nov 8, 2012, at 4:24 PM, Quincey Morris 
<[email protected]> wrote:

> On Nov 8, 2012, at 13:23 , Matt Neuburg <[email protected]> wrote:
> 
>> The result (and this is the problem) is that the label truncates after the 
>> **first line** of the second paragraph ("Four score and seven years ago, our 
>> fa…"). Why? There's plenty of room in my label for more lines!
> 
> I believe it's just a quirk of the way the text system divides 
> responsibility, which is in turn a consequence of the archeology of text 
> capabilities. Paragraph styles  let you specify *one* line (with truncation) 
> or *multiple* lines (without truncation). There is a separate option that 
> truncates the last line of a multiple-line paragraph 
> (NSStringDrawingTruncatesLastVisibleLine), but AFAICT the only way to apply 
> this option is via 'drawWithRect:options:context:' -- I don't think there's 
> any way to specify the option as a string attribute. So, this text drawing 
> style would require a custom view rather than a UILabel.
> 

Yes, this turned out to be exactly right. I was misled by the repeated mantra 
in the WWDC 2012 videos about UILabel being your basic "nexus of power" for 
attributed strings. That mantra is a lie. It turns out that UILabel is your 
"nexus of inconvenience": it doesn't play very well with attributed strings, 
especially attributed strings with a paragraph style. As you suggested, I 
replaced my label with a plain-vanilla view that just draws the string directly 
using drawWithRect:... and all is well. Thanks. m.

--
matt neuburg, phd = [email protected], http://www.apeth.net/matt/
pantes anthropoi tou eidenai oregontai phusei
Programming iOS 5! http://shop.oreilly.com/product/0636920023562.do
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com


_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to