I have not found an question like this in a few days so I thought I would post it here...
So say I have a pi开发者_开发问答cture of a snowflake, I would usually drag in a uibutton and set to custom and add the image in but I do not want that because it will make a square border around the image and I want the button itself to be the image.
So the border of the image would be the outermost part of the button and nothing more.
How would I go upon doing this?
Assuming the image has a transparent background which shows through where the snowflake isn't...
You could add it as UIImageView, register it for "touch up inside" actions, then check the X/Y coordinates of the touch up against the the those X/Y coordinates of the image. If they are on a transparent bit, then it's not a "button press", but if there is data, it was a valid button push.
There are several "color picker" test code applications out there which do similar things. You should be able to use their code as a starting point.
精彩评论