我使用下面的代碼通過文字的UILabel文字刪除與顏色
NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithString:(text ? text : @"")];
[attributeString addAttribute:NSStrikethroughStyleAttributeName
value:@2
range:NSMakeRange(0, [attributeString length])];
label.attributedText = attributeString;
文字罷工有白色,因此刪除線也是白色的。我想將其改爲紅色。我該怎麼做?
謝謝。這做了[attributeString addAttribute:NSStrikethroughColorAttributeName value:[UIColor redColor] range:NSMakeRange(0,[attributeString length])]; –