Posted By

zopebie on 08/10/12


Tagged

UILabel ios


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

zopebie
cnathan


Creating UILabel programmatically


 / Published in: Objective C
 

Reference: http://iosfonts.com/

  1. - (void)viewDidLoad {
  2.  
  3. [super viewDidLoad];
  4.  
  5. CGRect labelFrame = CGRectMake(10,10,200,44);
  6.  
  7. UILabel *myLabel = [[UILabel alloc] initWithFrame:labelFrame];
  8.  
  9. myLabel.backgroundColor = [UIColor clearColor];
  10. myLabel.textColor = [UIColor redColor];
  11. myLabel.font = [UIFont fontWithName:@"Verdana" size:18.0];
  12.  
  13. myLabel.numberOfLines = 2;
  14. myLabel.text = @"Hello World\nSecond line";
  15.  
  16. myLabel.shadowColor = [UIColor darkGrayColor];
  17. myLabel.shadowOffset = CGSizeMake(1.0,1.0);
  18.  
  19. [self.view addSubview:myLabel];
  20.  
  21. [myLabel release];
  22. }

Report this snippet  

You need to login to post a comment.