How can I implement a view for users to draw in (specifically sign their name)? I would greatly prefer a library or sample code to implementing it myself.
Thanks
How can I implement a view for users to draw in (specifically sign their name)? I would greatly prefer a library or sample code to implementing it myself.
Thanks
Drawing a curved line is just a series of filled circles or small straight lines. A kind of differentiation.
UITouch
)Basics
There are series of methods for tracking touches.
– touchesMoved:withEvent:
– touchesEnded:withEvent:
– touchesCancelled:withEvent:
These methods are on UIView
.(methods themselves are defined in UIResponder
which is superclass of it)
Override them. In most cases tracking touch point is not a problem.
And send setNeedsDisplay
message to UIView itself to make it invalidate it's graphics state so it will redraw itself soon.
Override drawRect
method of the UIView
to draw something (like black disk) you need with Quartz (CGContext
). You may store tracked touch points to draw each lines. Basically, you have to redraw all of touch trails.
Optimization
CGImage
which can be retrieved UIImage
). So you need to draw just newly added touch points.More detailed informations and samples are on reference of methods/classes I mentioned. I attach a link: http://developer.apple.com/iphone/library/navigation/index.html#section=Topics&topic=Graphics%20%26amp%3B%20Animation