I have named a set of images like this:
Unselected:
nameOfTheImage
Selected:
nameOfTheImage~
In order to change the background image of a button, my code is written to take the string of the background image's name, and either append or take off the "~" to change it to the correct image.
So I tried this:
let backgroundString = String(selector.currentBackgroundImage!)
print(backgroundString)
But I get this:
<UIImage: 0x146d98b80>, {485, 300}
Is there any way to get the plain name of the background image?
Any help is greatly appreciated.
nameof thebackground imageof auibutton. refer these stackoverflow.com/questions/3158737/… . as a suggestion, how about to useuiimageviewinstead of abutton background imageUIImageView?UIButtoni.e..UIControlStateSelected..