I have a custom button with a round image.
The problem is that the controller is square by default so whenever i click on the corners of the image, the button responds calling the associated method, when in reality he shouldn´t because there is no image on the corners, so the button shouldn´t respond.
Anyone knows a work around this bug?
One way to handle this is to reduce the size of the button. It’ll still be a rectangle (or square) though. More involved way would be to implement
- (UIView *) hitTest: (CGPoint) pt withEvent: (UIEvent *) event& handle which area of the button was clicked & if its not in the circle you defined ignore that touch event.But if you ask me, let it be the way it is. In touch, people are rarely that accurate (compared to a mouse click). So the rectangle button provides more area for the user to tap on a button even if he is slightly off the mark.