I suppose no one remembers this:

http://www.cocoabuilder.com/archive/cocoa/323722-nsattributedstring-mysteriously-truncated-too-soon.html

Anyhow, I have finally realized after all this time that what I was seeing here 
was in fact the _standard_ behavior of NSAttributedString under iOS 6. If an 
NSAttributedString's paragraph style includes a `lineBreakMode` of 
`NSLineBreakByTruncatingTail`, and if that string is going to wrap in the width 
within which it is being drawn, then only the _first_ line is drawn (truncated).

The reason this confused me is that it isn't what I was expecting. It isn't 
what I was expecting because UILabel's truncation works (and always has worked) 
a different way: its `lineBreakMode` applied to a multiline string draws the 
_whole_ string, wrapping, as much as will fit in the full height of the label, 
and _then_ truncates the _last_ line.

So what we have now is that NSParagraphStyle and UILabel both have a 
`lineBreakMode` that can have a value of `NSLineBreakByTruncatingTail`, but 
they implement it very differently. (That is why I ended up having to achieve 
the same end using the NSAttributedString drawing option 
`NSStringDrawingTruncatesLastVisibleLine`.) Just wanted to make that perfectly 
clear for generations to come... :) m.


--
matt neuburg, phd = m...@tidbits.com, 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 (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to