Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

macRumorsUserX

macrumors newbie
Original poster
I am trying to do a hit test on a image I have loaded into an UIimageView. the image is one object about 50x50 inside of a 300x300 frame. so essentially, its a 300x300 transparent png file with the an object in the middle.

I only want a touch or tap to be registered when the user touches the object. not the actual transparent parts of the image.

how can this be done in swift?
 
I use UIButtons with an image only.

Only the non-transperant area will be triggering the function of the button.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.