objective c - How can I change the font size of a uilabel without changing the font itself? -


i'm having issue allow user select font label in project, when user sets size of label (using different button), label resets default font. i'd able retain font user had applied while still allowing user change font size. appreciated, thanks!

here's code..

-(ibaction)setfont{      [usertext setfont:[uifont fontwithname:@"arial-boldmt" size:50.0]];  //i had add size when setting font or else got error   }    -(ibaction)setfontsize{    [usertext setfont:[uifont systemfontofsize:24]];  } 

just use fontwithsize: method on label's current font:

- (ibaction)setfontsize {     // keep same font change size 24 points.     uifont *font = usertext.font;     usertext.font = [font fontwithsize:24]; } 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -