开发者

How to catch touch events for CG content in UIView?

I have a UIView subclass that draws a curved line within it's frame (using Core Graphi开发者_运维知识库cs). As expected, when you touch somewhere within the frame the view fires a touch event. But I only want the touch event to fire when the actual line is touched. How do I achieve that?

Thanks.


You'll have to setup some sort of collision detection. When you get a touch event in the frame, then call your "hit test" method. That method will simply check whether or not the touch point in the frame intersects with the curve.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜