Closed baecheung closed 8 years ago
yy_strikethroughStyle失效,不知道怎么解决
NSMutableAttributedString *text2 = [NSMutableAttributedString new]; { NSMutableAttributedString *one = [[NSMutableAttributedString alloc] initWithString:@"aaaa"]; one.yy_font = [UIFont systemFontOfSize:12]; one.yy_color = [UIColor blueColor]; [text2 appendAttributedString:one]; } { NSMutableAttributedString *one = [[NSMutableAttributedString alloc] initWithString:@"bbbb"]; one.yy_font = [UIFont systemFontOfSize:11]; one.yy_color = [UIColor lightGrayColor]; one.yy_strikethroughStyle = NSUnderlineStyleSingle; one.yy_strikethroughColor = one.yy_color; [text2 appendAttributedString:one]; } YYLabel *label2 = [[YYLabel alloc] initWithFrame:CGRectMake(0, 64, self.view.width, 100)]; label2.attributedText = text2; label2.textAlignment = NSTextAlignmentCenter; [self.view addSubview:label2];
注意看注释文档,yy_strikethroughStyle 这个只在 UIKit (UILabel/UITextView/...) 中起作用,不能用于 CoreText 或 YYText。
yy_strikethroughStyle
换 yy_textStrikethrough。
@ibireme 感谢!没注意到这个细节~
太厉害了
yy_strikethroughStyle失效,不知道怎么解决