Reputation: 1457
Hello I have some weird shapes that I need to handle the touchesBegan
method on. The issue is that UIViews
are square and the only way I could do it is to maybe declare a grid and then check the coordinates. Is there any other way of doing this?
Upvotes: 0
Views: 1360
Reputation: 9039
Also, if you have access this talk at WWDC 2012 was pretty awesome with respect to how to handle complex touch events:
https://developer.apple.com/videos/wwdc/2012/?id=200
Upvotes: 1
Reputation: 35394
Implement hitTest:withEvent:
in your UIView subclass. Return YES only if the CGPoint is inside the shape.
Check out this question for polygon shapes: How can I determine whether a 2D Point is within a Polygon?
Upvotes: 2