Draw Straight Line Google Maps iOS
GMSMutablePath *path = [GMSMutablePath path];
[path addCoordinate:CLLocationCoordinate2DMake(37.36, -122.0)];
[path addCoordinate:CLLocationCoordinate2DMake(37.45, -122.0)];
GMSPolyline *line = [GMSPolyline polylineWithPath:path];
line.map = mapView_;
how to draw an arc with line using UIBezierPath
Try with this (as you can see, I've used addQuadCurveToPoint a variant of addCurveToPoint proposed by @wain - ask google for addCurveToPoint and switch to picture search to see how it work ) :
-(void) drawRect:(CGRect)rect
{
UIBezierPath * aPath = [UIBezierPath bezierPath];
// Set the starting point of the shape.
[aPath moveToPoint:CGPointMake(CGRectGetMinX(rect), CGRectGetMinY(rect))];
// Draw some lines.
[aPath addLineToPoint:CGPointMake(CGRectGetMaxX(rect), CGRectGetMinY(rect))];
//changes start here !
//the point look to be at 80% down
[aPath addLineToPoint:CGPointMake(CGRectGetMaxX(rect), CGRectGetMaxY(rect) * .8)];
//1st arc
//The end point look to be at 1/4 at left, bottom
CGPoint p = CGPointMake(CGRectGetMaxX(rect) / 4, CGRectGetMaxY(rect));
CGPoint cp = CGPointMake( (CGRectGetMaxX(rect) / 4) + ((CGRectGetMaxX(rect) - (CGRectGetMaxX(rect) / 4)) / 2) , CGRectGetMaxY(rect) * .8);
[aPath addQuadCurveToPoint:p controlPoint:cp];
//2nd arc
//The end point look to be at 80% downt at left,
CGPoint p2 = CGPointMake(CGRectGetMinX(rect), CGRectGetMaxY(rect) * .8);
CGPoint cp2 = CGPointMake( (CGRectGetMaxX(rect) / 4) / 2 , CGRectGetMaxY(rect) * .8);
[aPath addQuadCurveToPoint:p2 controlPoint:cp2];
//close the path
[aPath closePath];
//set the line width
aPath.lineWidth = 2;
//set the stoke color
[[UIColor greenColor] setStroke];
//draw the path
[aPath stroke];
}
Related Topics
iOS Facebook Login "Given Url Is Not Allowed by the Application Configuration"
Get Index or Tag Value from Imageview Tap Gesture
How to Cancel Usernotifications
How to Remove the Bottom Gap of Uipageviewcontroller
iOS - Using Storyboard and Autolayout to Center the Uiscrollview
Today Extension View Flashes When Redrawing
Extract Last Word in String with Swift
Disable Warning Dialog If Bluetooth Is Powered Off iOS
iOS 7.0 and Arc: Uitableview Never Deallocated After Rows Animation
iOS 11 - Unable to Change Navigation Bar Height
How to Resolve iOS Link Errors with Opencv
Rails: Redirect_To 'Myapp://' to Call iOS App from Mobile Safari
Determine Percentage of Visibility of Horizontal Collectionview Cells on Screen
How to Integrate Payu Money in Swift