UIBezierPath Not Drawing

I'm trying to implement a method which draws a line based on gesture recognition but I can't get the UIBezierPath to display. I know the gesture recognizer is functioning because I print to log every time the method is activated. What is also confusing me is that the blue line that I draw previous to trying to draw the BezierPath displays but the BezierPath doesn't. Even if I manually add arbitrary points nothing is drawn, such as:

[myPath addLineToPoint:CGPointMake(50, 50)];

Here is the code in my UIView:

- (void)drawRect:(CGRect)rect

CGContextRef ctx = UIGraphicsGetCurrentContext(); 
CGContextSetRGBStrokeColor(ctx, 0, 0, 1.0, 1); 
CGContextMoveToPoint(ctx, 0, 150);
CGContextAddLineToPoint( ctx, 480, 150);

[myPath addLineToPoint:CGPointMake(50, 50)];
[myPath stroke];

- (IBAction)handlePan:(UIPanGestureRecognizer *) recognizers {

CGPoint translation = [recognizers translationInView:self];

[myPath addLineToPoint:CGPointMake(translation.x, translation.y)];
[self setNeedsDisplay];

Thanks for any help!


Where are you initializing myPath? Make sure that it is initialized.

And just like

CGContextMoveToPoint(ctx, 0, 150);

, you need to call move to point on myPath before adding the line

[myPath moveToPoint:CGPointMake(0,150)];
[myPath addLineToPoint:CGPointMake(50, 50)];

Need Your Help

Iterate through updating F# Map vs a C# Dictionary

map f# key-value c#-to-f# keyvaluepair

I have a collection of key/value pairs contained inside an F# Map

how to make a count up timer that shows same number for everyone for php/html

php mysql html timer

I found a website that has a counter and it just keeps counting and shows the same number for everyone. Some how the number is being stored. can someone help me recreate this count up timer in php or