In my app one requirement is to set background of label to some image. I have done it by setting image at the back of UIlabel by this code
.H file
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
{
UIImageView *lblBGIV;
}
@end
.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];
}