2015-11-20 49 views

回答

3

使用attributeString

截图

enter image description here

代码

NSDictionary * attribtues = @{NSStrikethroughStyleAttributeName:@(NSUnderlineStyleSingle), 
           NSStrikethroughColorAttributeName:[UIColor redColor]}; 
NSAttributedString * attr = [[NSAttributedString alloc] initWithString:@"label" attributes:attribtues]; 
self.label.attributedText = attr; 
+0

可以在故事板中做到这一点吗? – james

+0

你有静态文本标签吗?我只需拖动一个插座,然后在'viewDidLoad'中设置? – Leo

+0

你不能在storyborad 中做到这一点,你必须通过代码来做到这一点 –