I have an image with a transparent background. I've put it in the label of a button. I want the button to only be tappable on the non-transparent parts of the image. My understanding is that I can make my button have a clip shape which will limit the tappable area, but my picture has a very odd shape and giving the button a generic "bounding box" so to speak would not be sufficient. It would end up with either far too much tappable space outside the image or far too little of the image being tappable.
So my question is: Can I make the button ONLY tappable on the solid or non-transparent parts of the image?
I've had a few ideas that might work, but I lack the experience to set them up. For example:
- Make a button, and add modifiers to make the frame of the button equivalent to the image, clipping out any transparent areas
- Make a custom shape from the image, and set the button's clip shape to that shape
- Somehow extract the opaque parts of the image, like a mask, and use that for a clip shape or similar