Posted By

arpit on 07/17/09


Tagged

iphone UILabel


Versions (?)

Creating a UILabel dynamically


 / Published in: Objective C
 

  1. UILabel *scoreLabel = [ [UILabel alloc ] initWithFrame:CGRectMake((self.bounds.size.width / 2), 0.0, 150.0, 43.0) ];
  2. scoreLabel.textAlignment = UITextAlignmentCenter;
  3. scoreLabel.textColor = [UIColor whiteColor];
  4. scoreLabel.backgroundColor = [UIColor blackColor];
  5. scoreLabel.font = [UIFont fontWithName:@"Arial Rounded MT Bold" size:(36.0)];
  6. [self addSubview:scoreLabel];
  7. scoreLabel.text = [NSString stringWithFormat: @"%d", score];

Report this snippet  

You need to login to post a comment.