Featured post
objective c - Animating the drawing of a line programtaically using Quartz 2d on IOS -
i'm trying draw animated growing line using quartz 2d, adding points existing line, gradually on time. started drawing new line, in drawrect method of uiview, obtaining cgcontextref, setting draw properties, , moving first point (0,0).
cgcontextref context= uigraphicsgetcurrentcontext(); cgcontextsetstrokecolorwithcolor(context,[uicolor bluecolor].cgcolor); cgcontextsetlinewidth(context, 2); cgcontextmovetopoint(context,0,0);
later, in next drawrect call, tried extending line, again, obtaining cgcontextref, , adding new point it.
gcontextref context= uigraphicsgetcurrentcontext(); cgcontextaddlinetopoint(context,x,y);
but seems current cgcontextref doesn't have record of previous cgcontextmovetopoint command last drawrect call, therefore doesn't have reference started drawing line.
am doing wrong here? there way refering drawn line?
you need treat each call drawrect
if starting scratch. if asked update subrect of view, should assume state associated graphics context, such drawing position , colours, have been reset. in case, need keep track of start position , redraw whole line each time.
- Get link
- X
- Other Apps
Comments
Post a Comment