ibireme / YYText

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

yy_strikethroughStyle失效 #291

Closed baecheung closed 8 years ago

baecheung commented 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];
ibireme commented 8 years ago

注意看注释文档,yy_strikethroughStyle 这个只在 UIKit (UILabel/UITextView/...) 中起作用,不能用于 CoreText 或 YYText。

换 yy_textStrikethrough。

baecheung commented 8 years ago

@ibireme 感谢!没注意到这个细节~

JH90iOS commented 5 years ago

太厉害了