zipme / RQShineLabel

Secret app like text animation
MIT License
1.97k stars 218 forks source link

can it be done with a uitextview? #7

Open ghost opened 10 years ago

ghost commented 10 years ago

can it be done with a uitextview?

NBibikov commented 9 years ago

@johnSD have you found the answer? I also need work it with UITextView

zipme commented 9 years ago

It's possible since the plugin is relying on attributeText property of UILabel which UITextView also has, I am thinking of rewriting this plugin in Swift 2.0, and by taking advantage of extension/protocol we can avoid lots of code duplication.

In the meantime, you can just copy RQShineLabel.h/m and change the subclass UILabel to UITextView, (perhaps also change ShineLabel to ShineTextView 😉) Things should just work.

NBibikov commented 9 years ago

Thanks! I done it with change sublacss to UITextView and add some property for mutableAttributedString(because without it i cann't change font family, font size and alignment in my controller)

[mutableAttributedString addAttribute:NSFontAttributeName
                                value:self.typeSizeFont
                                range:NSMakeRange(0, mutableAttributedString.length)];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
paragraphStyle.alignment = NSTextAlignmentCenter;
[mutableAttributedString addAttribute:NSParagraphStyleAttributeName
                       value:paragraphStyle
                       range:NSMakeRange(0, mutableAttributedString.length)];