文字上的删除线

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

    

 

posted @ 2014-12-22 19:48  浪够L就回家  阅读(351)  评论(0编辑  收藏  举报