Creating a UILabel dynamically


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



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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.