Class

MKOverlayPathRenderer

The visual representation for a path-based overlay.

Declaration

class MKOverlayPathRenderer : MKOverlayRenderer

Overview

Use this renderer when your overlay's shape is defined by a CGPath object. By default, this renderer fills and strokes the path using its current attributes.

You can use this class as-is or subclass to define additional drawing behaviors. If you subclass, you should override the createPath() method and use that method to build the appropriate path object. To change the path, invalidate it and recreate the path using whatever new data your subclass has obtained.

Topics

Creating and Managing the Path

var path: CGPath!

The path representing the overlay’s shape.

func createPath()

Creates the path for the overlay.

func invalidatePath()

Updates the path associated with the overlay renderer.

Accessing the Drawing Attributes

var fillColor: UIColor?

The fill color to use for the path.

var strokeColor: UIColor?

The stroke color to use for the path.

var lineWidth: CGFloat

The stroke width to use for the path.

var lineJoin: CGLineJoin

The line join style to apply to corners of the path.

var lineCap: CGLineCap

The line cap style to apply to the open ends of the path.

var miterLimit: CGFloat

The limiting value that helps avoid spikes at junctions between connected line segments.

var lineDashPhase: CGFloat

The offset (in points) at which to start drawing the dash pattern.

var lineDashPattern: [NSNumber]?

An array of numbers specifying the dash pattern to use for the path.

Drawing the Path

func applyStrokeProperties(to: CGContext, atZoomScale: MKZoomScale)

Applies the receiver’s current stroke-related drawing properties to the specified graphics context.

func applyFillProperties(to: CGContext, atZoomScale: MKZoomScale)

Applies the receiver’s current fill-related drawing properties to the specified graphics context.

func strokePath(CGPath, in: CGContext)

Draws a line along the specified path.

func fillPath(CGPath, in: CGContext)

Fills the area enclosed by the specified path.

Relationships

Inherits From

Conforms To