tags:

views:

26

answers:

1

i want to display a number on image like badge of size 30*28 ,which is placed upon button image,

i have an badge image to set up on the top of button image.. on top of badge image i should able to display text or number and my badge size is 30*28...

so ,for this to achieve i want to set a label on top of my button image and so i want to set label background to some image called badge image

+1  A: 

You can't add a background image to a UILabel, but you can add a UIImageView as a subview to a UILabel. Make sure the UILabel has backgroundColor = [UIColor clearColor]; for transparency.

E.g.

UIImageView *labelBackground = [[UIImageView alloc] 
    initWithImage:[UIImage imageNamed:@"mybg.png"]];
[myLabel addSubview:labelBackground];
[labelBackground release];
myLabel.backgroundColor = [UIColor clearColor];

Should work. Untested.

Kalle