I am developing iPhone application and I have taken UIView and I want to draw particular region on view on user touchMove event. So please can anybody suggest to me how to do it means how to implement the touchMove event so it can draw region concurrently with user touchMove.
Asked
Active
Viewed 847 times
2
-
can you show us what code you have/any attempts youve made? – ASKASK Apr 04 '14 at 16:58
-
I tried with this Code http://stackoverflow.com/questions/2249683/how-to-draw-polygons-with-cgpath – iOSHack Apr 04 '14 at 17:10
-
I also tried this code http://stackoverflow.com/questions/4669490/how-to-draw-line-on-touch-event but still its not working.please help me – iOSHack Apr 05 '14 at 10:23
1 Answers
2
What you need to do is:
- Create subclass of
UIView
. - Implement all the touch methods like
touchesBegan:
,touchesMoved:
, etc. - Use
drawRect:
,UIGraphicsBeginImageContextWithOptions
andUIBezierPath
to draw image based on touch locations.
There are many tutorials on the internet. I find this one quite good: Advanced Freehand Drawing Techniques

Rafał Sroka
- 39,540
- 23
- 113
- 143
-
Thanks As I am new in iOS programming So can I draw without using UIImage additional on simple UIView. – iOSHack Apr 05 '14 at 07:56
-
@Ashok, implementing drawing is not a trivial task. That's why I recommend you following a tutorial that explains step by step what you should do. – Rafał Sroka Apr 05 '14 at 08:24