iOS Developer Library

Developer

MapKit Framework Reference MKOverlayPathRenderer Class Reference

Options
Deployment Target:

On This Page
Language:

MKOverlayPathRenderer

The MKOverlayPathRenderer class draws a map overlay whose shape is represented by a CGPathRef data type. The default drawing behavior of this class is to apply the object’s current fill attributes, fill the path, apply the current stroke attributes, and then stroke the path. More...

Conforms To


Import Statement


import MapKit @import MapKit;

Availability


Available in iOS 7.0 and later.
  • fillColor fillColor Property

    The fill color to use for the path.

    Declaration

    Swift

    var fillColor: UIColor!

    Objective-C

    @property(strong) UIColor *fillColor

    Import Statement

    import MapKit

    Availability

    Available in iOS 7.0 and later.

  • The stroke color to use for the path.

    Declaration

    Swift

    var strokeColor: UIColor!

    Objective-C

    @property(strong) UIColor *strokeColor

    Import Statement

    import MapKit

    Availability

    Available in iOS 7.0 and later.

  • lineWidth lineWidth Property

    The stroke width to use for the path.

    Declaration

    Swift

    var lineWidth: CGFloat

    Objective-C

    @property CGFloat lineWidth

    Discussion

    The default value of this property is 0.

    Import Statement

    import MapKit

    Availability

    Available in iOS 7.0 and later.

  • lineJoin lineJoin Property

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

    Declaration

    Swift

    var lineJoin: CGLineJoin

    Objective-C

    @property CGLineJoin lineJoin

    Discussion

    The default line join style is kCGLineJoinRound.

    Import Statement

    import MapKit

    Availability

    Available in iOS 7.0 and later.

  • lineCap lineCap Property

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

    Declaration

    Swift

    var lineCap: CGLineCap

    Objective-C

    @property CGLineCap lineCap

    Discussion

    The line cap style is applied to the start and end points of any open subpaths. This property does not affect closed subpaths. The default line cap style is kCGLineCapRound.

    Import Statement

    import MapKit

    Availability

    Available in iOS 7.0 and later.

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

    Declaration

    Swift

    var miterLimit: CGFloat

    Objective-C

    @property CGFloat miterLimit

    Discussion

    The miter limit helps you avoid spikes in paths that use the kCGLineJoinMiter join style. If the ratio of the miter length—that is, the diagonal length of the miter join—to the line thickness exceeds the miter limit, the joint is converted to a bevel join. The default miter limit is 10, which results in the conversion of miters whose angle at the joint is less than 11 degrees.

    Import Statement

    import MapKit

    Availability

    Available in iOS 7.0 and later.

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

    Declaration

    Swift

    var lineDashPhase: CGFloat

    Objective-C

    @property CGFloat lineDashPhase

    Discussion

    Use this property to start drawing a dashed line partway through a segment or gap. For example, a phase value of 6 for the patter 5-2-3-2 would cause drawing to begin in the middle of the first gap.

    The default value of this property is 0.

    Import Statement

    import MapKit

    Availability

    Available in iOS 7.0 and later.

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

    Declaration

    Swift

    var lineDashPattern: [AnyObject]!

    Objective-C

    @property(copy) NSArray *lineDashPattern

    Discussion

    The array contains one or more NSNumber objects that indicate the lengths (measured in points) of the line segments and gaps in the pattern. The values in the array alternate, starting with the first line segment length, followed by the first gap length, followed by the second line segment length, and so on.

    This property is set to nil by default, which indicates no line dash pattern.

    Import Statement

    import MapKit

    Availability

    Available in iOS 7.0 and later.

  • path path Property

    The path representing the overlay’s shape.

    Declaration

    Swift

    var path: CGPath!

    Objective-C

    @property CGPathRef path

    Discussion

    Getting the value of this property causes the path to be created (using the createPath method) if it does not already exist. You can assign a path object to this property explicitly. When assigning a new path object to this property, the overlay renderer stores a strong reference to the path you provide.

    Import Statement

    import MapKit

    Availability

    Available in iOS 7.0 and later.

  • Creates the path for the overlay.

    Declaration

    Swift

    func createPath()

    Objective-C

    - (void)createPath

    Discussion

    The default implementation of this method does nothing. Subclasses should override it and use it to create the CGPathRef data type to be used for drawing. After creating the path, your implementation should assign it to the path property.

    Import Statement

    import MapKit

    Availability

    Available in iOS 7.0 and later.

  • Updates the path associated with the overlay renderer.

    Declaration

    Swift

    func invalidatePath()

    Objective-C

    - (void)invalidatePath

    Discussion

    Call this method when a change in the path information would require you to recreate the overlay’s path. This method sets the path property to nil and tells the overlay renderer to redisplay its contents.

    Import Statement

    import MapKit

    Availability

    Available in iOS 7.0 and later.

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

    Declaration

    Swift

    func applyStrokePropertiesToContext(_ context: CGContext!, atZoomScale zoomScale: MKZoomScale)

    Objective-C

    - (void)applyStrokePropertiesToContext:(CGContextRef)context atZoomScale:(MKZoomScale)zoomScale

    Parameters

    context

    The graphics context used to draw the view’s contents.

    zoomScale

    The current zoom scale used for drawing.

    Discussion

    This is a convenience method for applying all of the drawing properties used when stroking a path. This method applies the stroke color, line width, line join, line cap, miter limit, line dash phase, and line dash attributes to the specified graphics context. This method applies the scale factor in the zoomScale parameter to the line width and line dash pattern automatically so that lines scale appropriately.

    This method does not save the current graphics state before applying the new attributes. If you want to preserve the existing state, you must save it yourself and restore it later when you finish drawing.

    Import Statement

    import MapKit

    Availability

    Available in iOS 7.0 and later.

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

    Declaration

    Swift

    func applyFillPropertiesToContext(_ context: CGContext!, atZoomScale zoomScale: MKZoomScale)

    Objective-C

    - (void)applyFillPropertiesToContext:(CGContextRef)context atZoomScale:(MKZoomScale)zoomScale

    Parameters

    context

    The graphics context used to draw the view’s contents.

    zoomScale

    The current zoom scale used for drawing.

    Discussion

    This is a convenience method for applying all of the drawing properties used when filling a path. This method applies the current fill color to the specified graphics context.

    Import Statement

    import MapKit

    Availability

    Available in iOS 7.0 and later.

  • Draws a line along the specified path.

    Declaration

    Swift

    func strokePath(_ path: CGPath!, inContext context: CGContext!)

    Objective-C

    - (void)strokePath:(CGPathRef)path inContext:(CGContextRef)context

    Parameters

    path

    The path to draw.

    context

    The graphics context in which to draw the path.

    Discussion

    You must set the current stroke color before calling this method. Typically you do this by calling the applyStrokePropertiesToContext:atZoomScale: method prior to drawing. If the strokeColor property is currently nil, this method does nothing.

    Import Statement

    import MapKit

    Availability

    Available in iOS 7.0 and later.

  • Fills the area enclosed by the specified path.

    Declaration

    Swift

    func fillPath(_ path: CGPath!, inContext context: CGContext!)

    Objective-C

    - (void)fillPath:(CGPathRef)path inContext:(CGContextRef)context

    Parameters

    path

    The path to fill.

    context

    The graphics context in which to draw the path.

    Discussion

    You must set the current fill color before calling this method. Typically you do this by calling the applyFillPropertiesToContext:atZoomScale: method prior to drawing. If the fillColor property is currently nil, this method does nothing.

    Import Statement

    import MapKit

    Availability

    Available in iOS 7.0 and later.