The code is similar for both but what's the "best" way? If I'm reading things right it seems override hitTest: would be faster since it doesn't have to traverse all the child views but putting it in pointInside: seems safer since other methods/classes might call pointInside: to see how large the button is. Is there a winner here or does it not matter?
Asked
Active
Viewed 54 times
1 Answers
1
hitTest
calls pointInside
so i would definitely go for the changes in pointInside
.
Pros and Cons can be found here: Event handling for iOS - how hitTest:withEvent: and pointInside:withEvent: are related?
-
That does a good job of explaining how it works but it still doesn't give a solid answer as to which one is better. It seems overriding pointInside: would be less efficient since it's a recursive call where if you just override hitTest: it's one and done. pointInsde: seems more correct but I'm not sure why, every example I see online shows just override hitTest: – Ryan Detzel Feb 17 '16 at 14:48
-
I think there is no perfect answer. – Jonas Feb 17 '16 at 14:50