Breaking News
Home / iOS / iOS Snippets / How to change font to bold and color of a UILabel?

How to change font to bold and color of a UILabel?

Snippet

The following snippet provides a utiity method to change the label font from bold to regular along with that it changes the color to red or black respectively

  1. (void) updateLabel :(UILabel*) field emphasis :(BOOL) emphasis
  2. {
  3.     if (emphasis)
  4.     {
  5.         field.textColor = [UIColor redColor];
  6.  
  7.         UIFont* regFont =  [UIFont fontWithName:@"Verdana-Bold"  size:15];
  8.         [field setFont:regFont];
  9.  
  10.     }
  11.     else {
  12.         field.textColor = [UIColor blackColor];
  13.         UIFont* regFont =  [UIFont fontWithName:@"Verdana"  size:15];
  14.  
  15.         [field setFont:regFont];
  16. }
  17.  
[pb_builder]

Check Also

EKCalendar – That account does not allow calendars to be added or removed

Usecase When I am trying to create a new Calendar programmatically using the EventKit API …

Advertisment ad adsense adlogger