首页 > 代码库 > 文字上的删除线

文字上的删除线

技术分享

    NSString * str = @"ABCDEFG HIJKLMN";

    UILabel * aLab = [[UILabel alloc]initWithFrame:CGRectMake(10, 100, 300, 300)];

    aLab.text = str;

    NSMutableAttributedString * testAttriString = [[NSMutableAttributedString alloc] initWithString:str];

   [testAttriString addAttribute:NSStrikethroughStyleAttributeName value:[NSNumber numberWithInt:NSUnderlineStyleSingle] range:NSMakeRange(0, testAttriString.length)];

    aLab.attributedText = testAttriString;

    [self.view addSubview:aLab];

    

 

文字上的删除线