I've created an UIButton subclass and I need to get the path of the image that the button has. I can write self.path
but not self.imageView.image.path
Any idea?
1 Answer
I don't believe that you can get the path. If you look at the api docs for UIImage, you can instantiate with a file, but by the time you have an instance the file is gone and all that's still there is the NSData.
This wouldn't be very efficient, but if you know the candidate files that were used to create the image, then perhaps you could hash the NSData, and compare with a hash of the NSData on the UIButton's UIImage?