My IPhone app has a subclassed UIView being added to the main view to receive touch tap and drag events. A drag moves the subclassed UIView around the window, and a tap rotates it 45 degrees. Within the subclassed UIView I have used CoreGraphics path functions to draw a simple triangle.
My problem is that I would like to detect when the touch event has occurred only within the drawn triangle. I have the CGPoint which corresponds to the touch point for the entire device coordinate system and need to translate that point to the corresponding point on my graphics context within the UIView.
Originally I implemented my own translation function, which was able to successfully hit test using CGPathContainsPoint. Unfortunately once I rotate the UIView my function's limitations are reached and it seems like I'm trying to do this the hard way. I've experimented with CGContextConvertPointToUserSpace but it's results are not what I'd expect and I haven't been able to figure out how to use it properly yet.
Any help would be greatly appreciated.
My problem is that I would like to detect when the touch event has occurred only within the drawn triangle. I have the CGPoint which corresponds to the touch point for the entire device coordinate system and need to translate that point to the corresponding point on my graphics context within the UIView.
Originally I implemented my own translation function, which was able to successfully hit test using CGPathContainsPoint. Unfortunately once I rotate the UIView my function's limitations are reached and it seems like I'm trying to do this the hard way. I've experimented with CGContextConvertPointToUserSpace but it's results are not what I'd expect and I haven't been able to figure out how to use it properly yet.
Any help would be greatly appreciated.