How to apply bold for string in html format in iOS? -


i want print text in bold using string prints in compose mail app

messagebody = [nsstring stringwithformat:@"<b>background information</b>"]; 

what use nsattributedstring.  nsstring *boldfontname = [[uifont boldsystemfontofsize:12] fontname]; nsstring *yourstring = ...; nsrange boldedrange = nsmakerange(22, 4);  nsmutableattributedstring *attrstring = [[nsmutableattributedstring alloc] initwithstring:yourstring];  [attrstring beginediting]; [attrstring addattribute:kctfontattributename                     value:boldfontname                    range:boldedrange];  [attrstring endediting]; //draw attrstring here...  or   use code    not want bother fonts (as not every variation of font contains "bold"), here way this:      nsmutableattributedstring *attrstring = [[nsmutableattributedstring alloc] initwithstring:"approximate distance: 120m away"];    [attrstring beginediting];    [attrstring applyfonttraits:nsboldfontmask                          range:nsmakerange(22, 4)];    [attrstring endediting]; 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

xcode - Swift Playground - Files are not readable -

jboss7.x - JBoss AS 7.3 vs 7.4 and differences -