tobihagemann / THLabel

UILabel subclass, which additionally allows shadow blur, inner shadow, stroke text and fill gradient.
https://tobiha.de
Other
665 stars 111 forks source link

Multiple Line Label Issues #12

Closed MattFoley closed 10 years ago

MattFoley commented 10 years ago

Hi,

Thanks for the great work on the repo. I just have a couple small issues (maybe hard issues to fix), for some custom UI work I'm doing.

The first is that it seems that with multiple line labels the gradient isn't drawn per line, but rather over all lines.

The second is that multiple line labels don't scale to fit, so if I set my numberOfLines to 2, and minimum font scale to .5, THLabel does not follow those guidelines. IE: A long string leads to 3 or 4 lines, instead of 2 lines with a scaled font size.

Are either of these issues fixable off the top of your head? I'll look into them a bit myself, but I wanted to leave you a note.

Thanks!

tobihagemann commented 10 years ago

Hi,

regarding first issue: That's a known issue, yes. A solution would be to restructure THLabel from a "frame draw" to a "line-based draw" approach. Essentially replacing CTFrameDraw with CTLineDraw (with looping and such). Haven't found the time to do that though, it's on my to-do list.

regarding second issue: Hm, yes numberOfLines is generally being ignored, because I don't think Core Text is supporting this. You would've need to implement this completely "by hand". Maybe (or hopefully) I'm wrong and it would be easy to implement this with Core Text. I'm not sure right now.

Cheers, Tobias

MattFoley commented 10 years ago

Thanks for the info man, for now I just split our strings up into a THLabel and string for each line. It seems like those changes would be a bit of a challenge to implement in THLabel, but thanks, appreciate all the work!