ibireme / YYText

Powerful text framework for iOS to display and edit rich text.
MIT License
8.84k stars 1.69k forks source link

YYTextView's font will change after adding a attachment #864

Open starFelix opened 5 years ago

starFelix commented 5 years ago

I had set the font of YYTextView to 17. But if I add an attachment to this textview, the font of YYTextView would change. And I can't do anything to avoid it.

image
liuliangju commented 5 years ago

I do like this,it works well

_textView = [[YYTextView alloc] initWithFrame:self.view.frame];
NSMutableAttributedString *mAtt = [[NSMutableAttributedString alloc] initWithString:@""];
[mAtt addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:18] range:NSMakeRange(0, mAtt.length)];
mAtt.yy_lineSpacing = 6.0f;
mAtt.yy_kern = @(0.5);
_textView.selectedRange = NSMakeRange(mAtt.length, 0);
_textView.attributedText = mAtt;
_textView.font = [UIFont systemFontOfSize:18];
_textView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
starFelix commented 5 years ago

I do like this,it works well

_textView = [[YYTextView alloc] initWithFrame:self.view.frame];
NSMutableAttributedString *mAtt = [[NSMutableAttributedString alloc] initWithString:@""];
[mAtt addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:18] range:NSMakeRange(0, mAtt.length)];
mAtt.yy_lineSpacing = 6.0f;
mAtt.yy_kern = @(0.5);
_textView.selectedRange = NSMakeRange(mAtt.length, 0);
_textView.attributedText = mAtt;
_textView.font = [UIFont systemFontOfSize:18];
_textView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;

I don't think it's good enough. If I want some feature in specific range which do not want cover by other setting, I cound not use this way.

sandychales commented 5 years ago

I had set the font of YYTextView to 17. But if I add an attachment to this textview, the font of YYTextView would change. And I can't do anything to avoid it.

image

Hi, have you already solve this problem?

starFelix commented 5 years ago

@sandychales If you want to solve this problem, you should change the source code of YYText by removing the continuous feature. I didn't find any other ways to solve it.

SolorzanoJose commented 4 years ago

@starFelix how to remove it?

SolorzanoJose commented 4 years ago

@starFelix do you know how to remove the continuous feature?