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?
This should do the trick:
yourLabel.backgroundColor = UIColor(patternImage: UIImage(named: "backgroundImage")!)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With