i want display string in uilabel
, part of has strikethrough style. seems can't put strikethrough attribute on part of string. if it's on whole string, displays; if it's on part of string, not. bug? missing something?
here example code, , screen shot.
class viewcontroller: uiviewcontroller { @iboutlet weak var label1: uilabel! @iboutlet weak var label2: uilabel! override func viewdidload() { super.viewdidload() let strikeattrs = [nsstrikethroughstyleattributename: nsunderlinestyle.stylesingle.rawvalue] let str1 = nsmutableattributedstring() str1.append(nsattributedstring(string: "aaa", attributes: strikeattrs)) let str2 = nsmutableattributedstring() str2.append(nsattributedstring(string: "aaa", attributes: nil)) str2.append(nsattributedstring(string: "bbb", attributes: strikeattrs)) label1.attributedtext = str1 label2.attributedtext = str2 } }
the screen looks this:
Comments
Post a Comment