2015-11-20 41 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 中做到這一點,你必須通過代碼來做到這一點 –