In my application, one requirement is to set the background of the label on an image. I did this by setting the image at the end of UIlabel using this code
.H file
.M file
- (void)viewDidLoad { [super viewDidLoad]; lblBGIV = [[UIImageView alloc] init]; UIImage *lblBGImg = [[UIImage imageNamed:@"textlblbg.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 8, 0, 8)]; lblBGIV.image = lblBGImg; } - (void)updateLabelMethod:(NSTimer *)theTimer { lblBGIV.frame = CGRectMake(label.frame.origin.x-9, label.frame.origin.y-5, label.frame.size.width+18, 26); [self.myScrollView addSubview:lblBGIV]; [self.myScrollView sendSubviewToBack:lblBGIV]; }
user2452016
source share