ios - '_ ??' is not convertible to '()' with NSMutableAttributedString -


i've i'm pretty new swift , i'm stuck in setting nsmutableattributedstring in uilabel.

var attributedstring = nsmutableattributedstring("random string example") attributedstring.addattribute(nsforegroundcolorattributename, value: uicolor.redcolor(), range: nsmakerange(1, 3)) tweettextlabel?.text = attributedstring 

the last line gives me: '_ ??' not convertible '()' can't compile.

i tried with:

tweettextlabel?.text = attributedstring.string 

but in way lose color attribute

you should set attributedtext property of uilabel, like:

tweettextlabel?.attributedtext = attributedstring 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -