Creating UILabel programmatically


/ Published in: Objective C
Save to your folder(s)

Reference: http://iosfonts.com/


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.