I’m trying to get the image assigned to a button on click, so I can assign it to something else when the button is clicked.
I think I’m nearly there, I’ve managed to get the following info from the button
Sender info is: <UIImageView: 0x757d9b0; frame = (0 0; 100 100); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x757da10>> - image-name.png
As you can see, the image name is appended at the end of the log but I’m not sure how to get just that.
The code I’ve used to get this is:
sender.imageView
Thanks in advance for any help
EDIT:
Thanks to @zoul for leading me on the right path.
I ended up doing the following:
UIImage *image = [sender imageForState:UIControlStateNormal];
[self.newButton setImage:image forState:UIControlStateNormal];
There’s an
imageForState:method onUIButton.