drawing - How to detect encosed area in iOS and fill color inside that? -


i need create app paint application in windows. please check out video @ link

https://dl.dropboxusercontent.com/u/56721867/screen%20recording.mov

this how need app working. able draw lines , fill color using uibezierpath , cgcontext class how can fill color within enclosed area tapping inside shown in video. please let me know approach , class in ios can make possible. thanks!

we have uibezierpath property containspoint:

add following code in - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event

if ([apath containspoint:touchloc1]) { //then set flag value.             } 

and in - (void)drawrect:(cgrect)rect method add following code

if (flag){    [[uicolor redcolor] setfill];     [yourpath fill]; } else{ //whatever code requires drawing. } 

hope work's.


Comments