LTMorphingLabel
LTMorphingLabel copied to clipboard
Attributed Text Support
I believe the current version doesn't support morphing for attributed text. Will this be a feature in the near future?
It requires tons of tweaks. I hope I have enough time to do it.
Here is the concept.
┌─────────────────────────────────────────────────────────────┐
│ self.attributedString = ...SOME_NEW_STRING... │
└─────────────────────────────────────────────────────────────┘
│
┌───────────────┘
▼ ┌──────────────────────────┐
┌─────────────────────────────┐ ┌─▶│ enumerate each character │
│ draw the string off screen │─┘ └──────────────────────────┘
└─────────────────────────────┘ │
┌─────────────────┘
▼
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ return ([rectOfChar], [colorOfChar], [fontOfChar]) ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
│
▼
┌─────────────────────────────────────────────────────────────┐
│ calculate the new tuple by current morphingProgress │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ draw each character on screen between display blinks │
└─────────────────────────────────────────────────────────────┘
+100 for the effort! I tried approaching this but could not get it to work…
On Jul 23, 2015, at 4:27 PM, Lex Tang [email protected] wrote:
It requires tons of tweaks. I hope I have enough time to do it.
— Reply to this email directly or view it on GitHub.
Oh :( I needed this feature too because I use attributed string :(
Brilliant library!! That would be amazing if it supported Attributed String. @lexrus you wrote your last comment a year ago; is there any news for attributed string enhancement? In my case, the only reason I wanted to use attributed string is to be able to give 'character spacing'
+1
Any update on NSAttributedString or character spacing support?
This is definitely more of a work around than a solution, but if you're trying to set character spacing you can play around with these whitespace characters and insert one between every character in your label when setting the text. I've found that thin space
and punctuation space
look nice, but you'll have to play around with a few to find one that fits your style guide best.
Not ideal, but it works ¯_(ツ)_/¯
+1
i want to