Quantcast
Channel: Developer Feed - Snippet
Viewing all articles
Browse latest Browse all 178

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

$
0
0

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.  

Viewing all articles
Browse latest Browse all 178

Trending Articles