0
나는 선을 그리는 UIView BoardView가 있습니다. 테이블 뷰에서 셀을 누르면 BoardView에 선을 그립니다.드로잉에 그려진 선을 지우는 방법은 무엇입니까?
첫 번째 셀을 모두 누르면 OK입니다. 선이 그려집니다. 이제 두 번째 셀을 누르면 첫 번째 줄을 지우고 두 번째 줄을 그립니다.
선을 그릴 지 여부를 알기 위해 부울 값이 있습니다. 의 ViewController에서
:- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if(self.boardView.drawLine) {
self.boardView.drawLine = NO;
[self.boardView setNeedsDisplay]; //redisplay the context without lines
}
Path * path = [self.grid.sommesPathArray objectAtIndex:indexPath.row];
[self.boardView drawPath:path];
self.boardView.drawLine = YES;
[self.boardView setNeedsDisplay]; // display the context with a line
}
BoardView.m에서 :
- (void)drawRect:(CGRect)rect {
if (self.drawLine) {
for(Line * line in lines)
[self drawLineWithContext: UIGraphicsGetCurrentContext() andLine:line]; //draw lines
}
}
내 문제는 선이 삭제되지 않습니다 것입니다.