0

how to connect dots and make a line and remove lines in ios?

How to to make flow line type of game for iOS?

this is link http://www.flowanswers.com/

This type of project have assigned to me.

This is not working for me

CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
CGContextSetStrokeColorWithColor(context, [[UIColor blackColor]CGColor]);
CGContextSetLineWidth(context, 1.0);
CGContextMoveToPoint(context, startPoint.x, startPoint.y);
CGContextAddLineToPoint(context, endPoint.x, endPoint.y);
CGContextStrokePath(context);
CGContextRestoreGState(context); 

I will have to do something else. This is not my solution. And I am finding the starting point. what I do to start this project?

I have no Idea where to start. What to search?

Any Idea or suggestions would be highly welcome.

Afreen Khan
  • 175
  • 1
  • 4
  • 12

1 Answers1

1

your code will work if u write this code in drawRect method of view by subclassing it. like this

- (void)drawRect:(CGRect)rect
    { 
        [[UIColor redColor]set];
        CGContextRef current=UIGraphicsGetCurrentContext();
        CGContextSetLineWidth(current, 0.5);
        CGContextMoveToPoint(current, 50, 50);
        CGContextAddLineToPoint(current, 100, 200);
        CGContextAddLineToPoint(current, 300, 300);
        CGContextStrokePath(current);
         }
Ravindra Bagale
  • 17,226
  • 9
  • 43
  • 70