Relying on sensory event

I am creating a paint tool with UIView touch events.


The touchsMoved event is not raised when trying to move very hard immediately after being touched.

so it is very difficult to draw 2 ~ 3 pixels line .

enter image description here Look at it just one pixel.

But in iOS Simulator, it works great.

enter image description here

I thought there was a device problem But in SketchBookX (a popular drawing app) works great too.

enter image description here

I am not using UIScrollView or UIGuestureRocognizer.

Please help me to solve this problem.

  • I took some screenshots and "novices are not allowed to post images." X (

source to share

2 answers

FINALLY I found my mistake!

enter image description here

If the touch moves very shortly after "touchhesBegan", "touchhesMoved" does not work.

But when "touches", it passes the moved point X (

A bit weird, but finally I did with it :)



It's one thing that there is a mouse on the input device of the simulator, where the "touch" point is strictly defined. The touchscreen works a little differently - 2-3px can be filtered out as noise.

People usually interpolate "missing" pixels with UIBezierPath: see Increase touchphonesMoved frequency calls



All Articles