dezinezync / NappUI

A collection of extended functionality for the UI components of Titanium SDK
Other
0 stars 1 forks source link

Feature request: add linespacing for attributed labels #1

Open ludolphus opened 11 years ago

ludolphus commented 11 years ago

Would be nice to have an option on the generic label to set the line spacing.

This code sort of works but the label's frame size (height) is somehow not calculated correctly when using this:

NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle setLineSpacing:2];
[attrS addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [text length])];

Similar code should probably be added to characterIndexAtPoint() to handle taps on the label attributes correctly

dezinezync commented 11 years ago

I've been wanting this myself. :smiley: Any clue on how to apply various line heights to various parts of the text? I'm still not sure how NSTextStorage works with UILabels, thus my keen interest on switching things over to UITextView

ludolphus commented 11 years ago

No clue, but I think you can/should only set one line spacing for the whole label. Or per line if that's possible at all because of rendering. I did try that code shown here but still having the 'overflowing' issue, so on my system [label sizeToFit] is doing something wrong somehow...

dezinezync commented 11 years ago

Ah! I see. If you have the Xcode installer, try a clean install over the weekend. Maybe that might fix it.

Cheers, Nikh.

On Mon, Oct 7, 2013 at 11:01 PM, Steven van Loef notifications@github.com wrote:

No clue, but I think you can/should only set one line spacing for the whole label. Or per line if that's possible at all because of rendering.

I did try that code shown here but still having the 'overflowing' issue, so on my system [label sizeToFit] is doing something wrong somehow...

Reply to this email directly or view it on GitHub: https://github.com/dezinezync/NappUI/issues/1#issuecomment-25828277