iOS Developer Library

Developer

MapKit Framework Reference MKOverlayPathView Class Reference

Options
Deployment Target:

On This Page
Language:

MKOverlayPathView

The MKOverlayPathView class represents a generic overlay that draws its contents using a CGPathRef data type. You can use this class to implement simple path-based overlay views or subclass it to define additional drawing behaviors. 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.

If you subclass, you should override the createPath method and use that method to build the appropriate path for the overlay. You can invalidate this path as needed and force the path to be recreated using whatever new data your subclass has obtained.

In iOS 7 and later, use the MKOverlayPathRenderer class to display path-based overlays instead.

Import Statement


Swift

import MapKit

Objective-C

@import MapKit;

Availability


Available in iOS 4.0 and later.
  • fillColor fillColor (iOS 7.0) Property

    The fill color to use for the path.

    Deprecation Statement

    Use an MKOverlayPathRenderer object instead.

    Declaration

    Objective-C

    @property(strong) UIColor *fillColor

    Import Statement

    Objective-C

    @import MapKit;

    Availability

    Available in iOS 4.0 and later.

    Deprecated in iOS 7.0.

  • strokeColor strokeColor (iOS 7.0) Property

    The stroke color to use for the path.

    Deprecation Statement

    Use an MKOverlayPathRenderer object instead.

    Declaration

    Objective-C

    @property(strong) UIColor *strokeColor

    Import Statement

    Objective-C

    @import MapKit;

    Availability

    Available in iOS 4.0 and later.

    Deprecated in iOS 7.0.

  • lineWidth lineWidth (iOS 7.0) Property

    The stroke width to use for the path.

    Deprecation Statement

    Use an MKOverlayPathRenderer object instead.

    Declaration

    Objective-C

    @property CGFloat lineWidth

    Discussion

    The default value of this property is 0.

    Import Statement

    Objective-C

    @import MapKit;

    Availability

    Available in iOS 4.0 and later.

    Deprecated in iOS 7.0.

  • lineJoin lineJoin (iOS 7.0) Property

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

    Deprecation Statement

    Use an MKOverlayPathRenderer object instead.

    Declaration

    Objective-C

    @property CGLineJoin lineJoin

    Discussion

    The default line join style is kCGLineJoinMiter.

    Import Statement

    Objective-C

    @import MapKit;

    Availability

    Available in iOS 4.0 and later.

    Deprecated in iOS 7.0.

  • lineCap lineCap (iOS 7.0) Property

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

    Deprecation Statement

    Use an MKOverlayPathRenderer object instead.

    Declaration

    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 kCGLineCapButt.

    Import Statement

    Objective-C

    @import MapKit;

    Availability

    Available in iOS 4.0 and later.

    Deprecated in iOS 7.0.

  • miterLimit miterLimit (iOS 7.0) Property

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

    Deprecation Statement

    Use an MKOverlayPathRenderer object instead.

    Declaration

    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

    Objective-C

    @import MapKit;

    Availability

    Available in iOS 4.0 and later.

    Deprecated in iOS 7.0.

  • lineDashPhase lineDashPhase (iOS 7.0) Property

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

    Deprecation Statement

    Use an MKOverlayPathRenderer object instead.

    Declaration

    Objective-C

    @property CGFloat lineDashPhase

    Import Statement

    Objective-C

    @import MapKit;

    Availability

    Available in iOS 4.0 and later.

    Deprecated in iOS 7.0.

  • lineDashPattern lineDashPattern (iOS 7.0) Property

    An array of numbers indicating the dash pattern for paths.

    Deprecation Statement

    Use an MKOverlayPathRenderer object instead.

    Declaration

    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

    Objective-C

    @import MapKit;

    Availability

    Available in iOS 4.0 and later.

    Deprecated in iOS 7.0.

  • path path (iOS 7.0) Property

    The current path to use when drawing the overlay.

    Deprecation Statement

    Use an MKOverlayPathRenderer object instead.

    Declaration

    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 also assign a path object to this property explicitly.

    When assigning a new path object to this property, the receiver retains the path you specify.

    Import Statement

    Objective-C

    @import MapKit;

    Availability

    Available in iOS 4.0 and later.

    Deprecated in iOS 7.0.

  • Creates the path for the overlay.

    Deprecation Statement

    Use an MKOverlayPathRenderer object instead.

    Declaration

    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 then assign it to the path property.

    Import Statement

    Objective-C

    @import MapKit;

    Availability

    Available in iOS 4.0 and later.

    Deprecated in iOS 7.0.

  • Releases the path associated with the receiver.

    Deprecation Statement

    Use an MKOverlayPathRenderer object instead.

    Declaration

    Objective-C

    - (void)invalidatePath

    Discussion

    You can call this method at any time where a change in the path information would require you to recreate the path. This method sets the path property to nil, which causes the cached path to be released.

    Import Statement

    Objective-C

    @import MapKit;

    Availability

    Available in iOS 4.0 and later.

    Deprecated in iOS 7.0.

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

    Deprecation Statement

    Use an MKOverlayPathRenderer object instead.

    Declaration

    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. You must save it yourself and restore it later when you are done drawing.

    Import Statement

    Objective-C

    @import MapKit;

    Availability

    Available in iOS 4.0 and later.

    Deprecated in iOS 7.0.

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

    Deprecation Statement

    Use an MKOverlayPathRenderer object instead.

    Declaration

    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

    Objective-C

    @import MapKit;

    Availability

    Available in iOS 4.0 and later.

    Deprecated in iOS 7.0.

  • Draws a line along the specified path.

    Deprecation Statement

    Use an MKOverlayPathRenderer object instead.

    Declaration

    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

    Objective-C

    @import MapKit;

    Availability

    Available in iOS 4.0 and later.

    Deprecated in iOS 7.0.

  • Fills the area enclosed by the specified path.

    Deprecation Statement

    Use an MKOverlayPathRenderer object instead.

    Declaration

    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

    Objective-C

    @import MapKit;

    Availability

    Available in iOS 4.0 and later.

    Deprecated in iOS 7.0.