开发者

Drawing where touch is detected

开发者 https://www.devze.com 2023-02-15 11:39 出处:网络
How can pixels be drawn at a touch location? If the user touches a certain area of a view, how are the locations used to draw/mark the loca开发者_如何学Gotion with e.g black color?

How can pixels be drawn at a touch location?

If the user touches a certain area of a view, how are the locations used to draw/mark the loca开发者_如何学Gotion with e.g black color?

What kind of view is this or how is this drawing done?


Generally, if you're using Quartz you'll:

  1. handle your touch events

  2. store the points that are streaming in in some datastructure

  3. invalidate your view so it draws

  4. override drawRect and draw the points you stored in 2.

UIBezierPath is a class that can help with this. You can essentially "draw into" an instance of UIBezierPath when you receive the touch events, then render the object in drawRect.

0

精彩评论

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

关注公众号