Sunday 15 February 2015

ios - UILabel with different fonts -


Want to appear in the string to me that I have a label like:

  NSString * criticsScore = [NSString stringWithFormat: @ "% @ \ %%", [Dic Objektforki: @ "Aloikkon_skor"]]; _criticRating.text = criticsScore;   

I \ %% and [dict objectForKey: @ "critics_score want a larger font set to"];
Is this possible?

You need to use your control to a NSAttributedString like

  NSMutableAttributedString * str = [[NSMutableAttributedString alloc] initWithString: [NSString stringWithFormat: @ "Blah1: fuck to% d Blah2: -.% d%%", [CurrentCoupon.couponPrice intValue ], [CurrentCoupon.couponDiscountPercent intValue]]; [Str addAttribute: NSBackgroundColorAttributeName Price: [UIColor clearColor] Range: NSMakeRange (0,30)]; /// range defined and the background color that you [str addAttribute here: NSForegroundColorAttributeName value: [UIColor blackColor] Range: NSMakeRange (0, 30)]; /// Range Define here and also the textcolor color you want [str addAttribute: NSFontAttributeName value: [UIFont fontWithName: @ "HelveticaNeue-Bold" Size: 20.0] Range: NSMakeRange (20, 10)]; LblWithText.attributedText = str; I got the code from the top   

No comments:

Post a Comment