RQShineLabel icon indicating copy to clipboard operation
RQShineLabel copied to clipboard

can it be done with a uitextview?

Open ghost opened this issue 11 years ago • 3 comments

can it be done with a uitextview?

ghost avatar Aug 07 '14 20:08 ghost

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

NBibikov avatar Jun 15 '15 14:06 NBibikov

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.

zipme avatar Jun 15 '15 15:06 zipme

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)];

NBibikov avatar Jun 15 '15 17:06 NBibikov