iphone - How to erase lines drawn in drawrect ? -


i have uiview boardview in draw lines. when push cell in table view, draw line in boardview.

when push first cell ok, lines drawn. now, if push second cell, erase first line , draw second line.

i have boolean know if have draw lines or not.

in viewcontroller :

- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {      if(self.boardview.drawline) {         self.boardview.drawline = no;        [self.boardview setneedsdisplay]; //redisplay context without lines     }      path * path = [self.grid.sommespatharray objectatindex:indexpath.row];     [self.boardview drawpath:path];     self.boardview.drawline = yes;     [self.boardview setneedsdisplay]; // display context line } 

in boardview.m :

- (void)drawrect:(cgrect)rect {      if (self.drawline) {             for(line * line in lines)             [self drawlinewithcontext: uigraphicsgetcurrentcontext() andline:line]; //draw lines     }  } 

my problem lines aren't deleted.

try 1 when push or select second cell or cell..

    [self.boardview.path removeallobjects];       [self.boardview setneedsdisplay]; 

or

    [self.grid.sommespatharray removeallobjects];         [self.boardview setneedsdisplay]; 

or remove points of uibezierpath used draw line on view linke bellow..

[mypath removeallpoints]; [self setneedsdisplay];    

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -