Reputation: 2128
i have UIlabel with image.my text are won't come into top of the image i want to show my text in top of the image.
image1.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"salarytax.png"]];
this is my code to adding image to label. this image is a output of that code. how can i show the text in top of the image
Upvotes: 1
Views: 9006
Reputation: 1282
UILabel *imageLabel;
[imageLabel setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"logo.png"]]];
[imageLabel setText:@"Khalid Usman"];
[imageLabel setTextColor:[UIColor blackColor]];
Note: I have checked it for conformation then i post. It's working.
Upvotes: 0
Reputation: 9740
try adding the UILabel
on the image
[myimageview addSubView: myLabel];
[myImageView bringSubviewToFront: myLabel];
If you have just taken the UILabel
and trying to set its background as an image then dont think it would create a problem.
If you are able to view the text on the label but you want the text to be vertically on top then you can set its contentVerticalAlignment
property to top.
Hope this helps..
Upvotes: 2