Reputation: 1242
I want to set background image for a label in my project but i dont know for how to set, please say it is possible or not?
Upvotes: 6
Views: 13369
Reputation: 36447
The UILabel control does not have background image
or image
property.
You can set image to UILabel
using backgroundColor
property as shown below :
cell.lblNumber!.text = ""
cell.lblNumber!.backgroundColor = UIColor(patternImage: UIImage(named: "OK")!)
Set the text to empty since it will display image and text on top of it.
Upvotes: 3
Reputation: 11435
This should do the trick:
yourLabel.backgroundColor = UIColor(patternImage: UIImage(named: "backgroundImage")!)
Upvotes: 18