0

I have the touchesBegan void before this which triggers this event, but i need this line to show, wait for so many seconds, then disappear:

    - (void)drawRect:(CGRect)rect {
      // Drawing code

//Make a simple rectangle and fill background BLUE with half Opeque
CGContextRef context = UIGraphicsGetCurrentContext();
//[[UIColor blueColor] set];
//CGContextSetRGBFillColor(context, 0.0, 0.0, 1.0, 1.0);
//rect = CGRectMake(20, 20, 40, 40);
//CGContextFillRect(context, rect);

//Make a simple RED line from 0,0 to 100, 100 in a FRAME
//CGContextSetRGBFillColor(context, 100.0, 0.0, 0.0, 1.0);
[[UIColor redColor] set];
CGContextMoveToPoint(context, _spaceShip.center.x, _spaceShip.center.y);
CGContextAddLineToPoint( context, nextLocX, nextLocY);

CODE FOR MAKING THE LINE DISAPPEAR

    }
nwellnhof
  • 32,319
  • 7
  • 89
  • 113

1 Answers1

0

Redraw the frame without that line would be the obvious solution.

Draw over it in the background color would be a less-pretty solution that might in some cases run faster.

bjorke
  • 3,295
  • 1
  • 16
  • 20