The clean way to deal with pointInside on a circular button is as follows:
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event { if (![super pointInside:point withEvent:event]) { return NO; } BOOL isInside = (pow((point.x-self.frame.size.width/2), 2) + pow((point.y - self.frame.size.height/2), 2) < pow((self.frame.size.width/2), 2)) ? YES:NO; return isInside; }
You can cut the "isInside" variabe, but this method is easier to test.
source share