SKMapView Class Reference

Inherits from UIView
Declared in SKMapView.h

Overview

The SKMapView class is used for displaying the map. It is the main class of the SKMaps framework and the entry point for all map related methods. SKMapView, like all UIKit objects, can only be managed from the main thread. Otherwise, it will result in an undefined behavior.

Other Methods

  delegate

The delegate that must conform to SKMapViewDelegate protocol, used for observing user interactions changes in the map.

@property (nonatomic, weak, nullable) id<SKMapViewDelegate> delegate

Discussion

The delegate that must conform to SKMapViewDelegate protocol, used for observing user interactions changes in the map.

Declared In

SKMapView.h

  settings

The SKMapSettings object that controls various UI and behavior settings of the map.

@property (nonatomic, readonly, strong) SKMapSettings *settings

Discussion

The SKMapSettings object that controls various UI and behavior settings of the map.

Declared In

SKMapView.h

  annotations

All the annotations that are currently added to this map view.

@property (nonatomic, readonly) NSArray<SKAnnotation*> *annotations

Discussion

All the annotations that are currently added to this map view.

Declared In

SKMapView.h

  visibleRegion

The visible map coordinate region.

@property (nonatomic, assign) SKCoordinateRegion visibleRegion

Discussion

The visible map coordinate region.

Declared In

SKMapView.h

  isInNavigationMode

Flag to verify if the map is in navigation mode or not.

@property (nonatomic, readonly) BOOL isInNavigationMode

Discussion

Flag to verify if the map is in navigation mode or not.

Declared In

SKMapView.h

  bearing

Controls the maps bearing, in degrees. 0 = North, +90 = East, +180 = South, +270 = West. DPERECATED: Use the bearing property of SKMapSettings.

@property (nonatomic, assign) float bearing

Discussion

Controls the maps bearing, in degrees. 0 = North, +90 = East, +180 = South, +270 = West. DPERECATED: Use the bearing property of SKMapSettings.

Declared In

SKMapView.h

  calloutView

Can be used for displaying data about a map POI or annotation. Can be activated using showCalloutAtCoordinate:withOffset: method. For further details check the SKCalloutView class.

@property (nonatomic, strong) SKCalloutView *calloutView

Discussion

Can be used for displaying data about a map POI or annotation. Can be activated using showCalloutAtCoordinate:withOffset: method. For further details check the SKCalloutView class.

Declared In

SKMapView.h

  mapScaleView

Manages the displaying of the map scale. The scale value is updated automatically based on the visible region of the map. By default it is hidden.

@property (nonatomic, readonly) SKMapScaleView *mapScaleView

Discussion

Manages the displaying of the map scale. The scale value is updated automatically based on the visible region of the map. By default it is hidden.

Declared In

SKMapView.h

  currentPositionView

Updates the current position icon on the map with a custom UIView. Setting the currentPositionView to nil restores the current position icon to it’s default state.

@property (nonatomic, strong, nullable) UIView *currentPositionView

Discussion

Updates the current position icon on the map with a custom UIView. Setting the currentPositionView to nil restores the current position icon to it’s default state.

Declared In

SKMapView.h

– applySettingsFromFileAtPath:

Configures the map view with the map settings from the specified path.

- (void)applySettingsFromFileAtPath:(NSString *)filePath

Parameters

filePath

The path to the configuration file.

Discussion

Configures the map view with the map settings from the specified path.

Declared In

SKMapView.h

– centerOnCurrentPosition

Centers the map to the current position.

- (void)centerOnCurrentPosition

Discussion

Centers the map to the current position.

Declared In

SKMapView.h

– animateToZoomLevel:

Animates the zooming of the map to a certain zoom level.

- (void)animateToZoomLevel:(float)zoom

Parameters

zoom

The zoom level the map will animate to.

Discussion

Animates the zooming of the map to a certain zoom level.

Declared In

SKMapView.h

– animateToBearing:

Animates the rotation of the map to a certain bearing.

- (void)animateToBearing:(float)bearing

Parameters

bearing

The bearing to which the map will animate to, in degrees (in [ 0, 360 ] interval).

Discussion

Animates the rotation of the map to a certain bearing.

Declared In

SKMapView.h

– animateToCoordinate:withPadding:duration:

Animates the center of the map to a certain coordinate.

- (void)animateToCoordinate:(CLLocationCoordinate2D)coordinate withPadding:(CGPoint)padding duration:(float)duration

Parameters

coordinate

The coordinate to be centered.

padding

The optional padding.

duration

The duration of the animation, in seconds.

Discussion

Animates the center of the map to a certain coordinate.

Declared In

SKMapView.h

– fitBounds:withInsets:

Sets the visible region of the map so that a provided coordinate bounding box will be visible.

- (void)fitBounds:(SKBoundingBox *)boundingBox withInsets:(UIEdgeInsets)insets

Parameters

boundingBox

The bounding box to be fitted.

insets

Insets in pixels for left, right, bottom and top of the screen.

Discussion

Sets the visible region of the map so that a provided coordinate bounding box will be visible.

Declared In

SKMapView.h

– pointForCoordinate:

Converts a CLLocationCoordinate2D coordinate to a screen point of the current map view, if the location is in the current map region bounds.

- (CGPoint)pointForCoordinate:(CLLocationCoordinate2D)coordinate

Parameters

coordinate

The coordinate to be converted.

Return Value

The converted CGPoint.

Discussion

Converts a CLLocationCoordinate2D coordinate to a screen point of the current map view, if the location is in the current map region bounds.

Declared In

SKMapView.h

– coordinateForPoint:

Converts a CGPoint screen point to a CLLocationCoordinate2D coordinate of the current map view.

- (CLLocationCoordinate2D)coordinateForPoint:(CGPoint)point

Parameters

point

The point to be converted.

Return Value

The converted coordinate.

Discussion

Converts a CGPoint screen point to a CLLocationCoordinate2D coordinate of the current map view.

Declared In

SKMapView.h

– addAnnotation:withAnimationSettings:

Adds an annotation to the map. By default, the center of the image will coincide with its coordinate.

- (BOOL)addAnnotation:(SKAnnotation *)annotation withAnimationSettings:(SKAnimationSettings *)animationSettings

Parameters

annotation

Model object for the annotation. For further details see SKAnnotation.

animationSettings

Represents the animation settings when adding an annotation to the map.

Discussion

Adds an annotation to the map. By default, the center of the image will coincide with its coordinate.

Declared In

SKMapView.h

– addCustomPOI:

Adds a custom POI to the map.

- (BOOL)addCustomPOI:(SKMapCustomPOI *)customPOI

Parameters

customPOI

Model object of the custom POI. For further details see SKMapCustomPOI.

Discussion

Adds a custom POI to the map.

Declared In

SKMapView.h

– bringToFrontAnnotation:

Brings a previously added annotation in front of the others.

- (BOOL)bringToFrontAnnotation:(SKAnnotation *)annotation

Parameters

annotation

The the annotation to be brought in front.

Return Value

Success/failure of bringing the annotation in the front.

Discussion

Brings a previously added annotation in front of the others.

Declared In

SKMapView.h

– updateAnnotation:

Updates a previously added annotation on the map. The annotation will be updated with the new properties.

- (BOOL)updateAnnotation:(SKAnnotation *)annotation

Parameters

annotation

Annotation to be updated. For further details see SKAnnotation.

Return Value

Success/failure of updating the annotation.

Discussion

Updates a previously added annotation on the map. The annotation will be updated with the new properties.

Declared In

SKMapView.h

– annotationForIdentifier:

Returns an SKAnnotation object with the given identifier. If their is no annotation with the given identifier, it returns nil.

- (nullable SKAnnotation *)annotationForIdentifier:(NSInteger)identifier

Parameters

identifier

The annotation identifier.

Return Value

The annotation with the given identifier.

Discussion

Returns an SKAnnotation object with the given identifier. If their is no annotation with the given identifier, it returns nil.

Declared In

SKMapView.h

– removeAnnotationWithIdentifier:

Removes the annotation with the specified ID.

- (void)removeAnnotationWithIdentifier:(NSInteger)identifier

Parameters

identifier

The ID of the annotation to be deleted from the map.

Discussion

Removes the annotation with the specified ID.

Declared In

SKMapView.h

– clearAllAnnotations

Removes all markers from the map.

- (void)clearAllAnnotations

Discussion

Removes all markers from the map.

Declared In

SKMapView.h

– showCalloutAtCoordinate:withOffset:animated:

Displays the callout view at the provided coordinate.

- (void)showCalloutAtCoordinate:(CLLocationCoordinate2D)coordinate withOffset:(CGPoint)calloutOffset animated:(BOOL)shouldAnimate

Parameters

coordinate

The coordinate where the callout view’s arrow should point.

calloutOffset

Provides a way for moving the callout view up, down, left or right. It’s recommended to use when the callout view covers a part of the annotation image.

shouldAnimate

A boolean value which indicated that the callout should appear animated at the given coordinate.

Discussion

Displays the callout view at the provided coordinate.

Declared In

SKMapView.h

– showCalloutForAnnotation:withOffset:animated:

Displays the callout view for the provided annotation.

- (void)showCalloutForAnnotation:(SKAnnotation *)annotation withOffset:(CGPoint)calloutOffset animated:(BOOL)shouldAnimate

Parameters

annotation

The coordinate where the callout view’s arrow should point.

calloutOffset

Provides a way for moving the callout view up, down, left or right. It’s recommended to use when the callout view covers a part of the annotation image.

shouldAnimate

A boolean value which indicated that the callout should appear animated.

Discussion

Displays the callout view for the provided annotation.

Declared In

SKMapView.h

– hideCallout

Hides the callout view.

- (void)hideCallout

Discussion

Hides the callout view.

Declared In

SKMapView.h

– renderMapImageInBoundingBox:toPath:withSize:

Generates a PNG image on the disk, with the map from the provided bounding box. This will be done asynchronously, and mapViewDidFinishRenderingImageInBoundingBox: will be called when the operation is finished.

- (void)renderMapImageInBoundingBox:(SKBoundingBox *)boundingBox toPath:(NSString *)imagePath withSize:(CGSize)size

Parameters

boundingBox

The bounding box of the generated map.

imagePath

The path on the disk where the image should be generated.

size

The desired size of the image.

Discussion

Generates a PNG image on the disk, with the map from the provided bounding box. This will be done asynchronously, and mapViewDidFinishRenderingImageInBoundingBox: will be called when the operation is finished.

Declared In

SKMapView.h

– lastRenderedFrame

Returns a UIImage representation of the last rendered frame.

- (nullable UIImage *)lastRenderedFrame

Discussion

Returns a UIImage representation of the last rendered frame.

Declared In

SKMapView.h

– startCurrentPositionAnnimationWithSettings:

Starts an animation around the current position icon based on the given settings.

- (BOOL)startCurrentPositionAnnimationWithSettings:(SKCurrentPositionAnimationSettings *)currentPositionAnimationSettings

Parameters

currentPositionAnimationSettings

The settings used for the pulse animation

Return Value

Success/failure

Discussion

Starts an animation around the current position icon based on the given settings.

Declared In

SKMapView.h

– stopCurrentPositionAnnimation

Stops the current position animation.

- (BOOL)stopCurrentPositionAnnimation

Return Value

Success/failure

Discussion

Stops the current position animation.

Declared In

SKMapView.h

RealReach Methods

– displayRealReachWithSettings:

Adds a real reach layer on the map.

- (void)displayRealReachWithSettings:(SKRealReachSettings *)realReachSettings

Parameters

realReachSettings

Contains settings for the RealReach layer.

Discussion

Adds a real reach layer on the map.

Declared In

SKMapView+RealReach.h

– clearRealReachDisplay

Clears the real reach layer from the map.

- (void)clearRealReachDisplay

Discussion

Clears the real reach layer from the map.

Declared In

SKMapView+RealReach.h

– fitRealReachWithDuration:

Changes the visible region in order to fit the currently displayed real reach polygon.

- (void)fitRealReachWithDuration:(NSInteger)duration

Parameters

duration

The duration of the animation in milliseconds. No animation will be performed if the value of this parameter is 0.

Discussion

Changes the visible region in order to fit the currently displayed real reach polygon.

Declared In

SKMapView+RealReach.h

– realReachBoundingBox

Returns the bounding box of the current real reach area displayed on map.

- (nullable SKBoundingBox *)realReachBoundingBox

Return Value

The bounding box corresponding to the current real reach area. Will return nil if there is no valid real reach displayed.

Discussion

Returns the bounding box of the current real reach area displayed on map.

Declared In

SKMapView+RealReach.h

– isRealReachDisplayedInBoundingBox:

Verifies if the real reach layer fits in the specified bounding box.

- (BOOL)isRealReachDisplayedInBoundingBox:(SKBoundingBox *)boundingBox

Parameters

boundingBox

Defines a bounding box on the map.

Return Value

A boolean value indicating if the RealReach fits in the specified bounding box.

Discussion

Verifies if the real reach layer fits in the specified bounding box.

Declared In

SKMapView+RealReach.h

– isCoordinateInsideRealReachPolygon:

Verifies if a coordinate is inside the real reach polygon.

- (BOOL)isCoordinateInsideRealReachPolygon:(CLLocationCoordinate2D)coordinate

Parameters

coordinate

The coordinate to be checked.

Return Value

A boolean value indicating if the coordinate is inside the rendered RealReach polygon.

Discussion

Verifies if a coordinate is inside the real reach polygon.

Declared In

SKMapView+RealReach.h

GPSFiles Methods

– drawGPSFileElement:

Renders a GPSFileElement on the map. The color of the rendered polyline can be set in the GPS file using the extensions, in the ‘color’ field. The color must be in RGBA format. Ex: FF0000FF.

- (BOOL)drawGPSFileElement:(SKGPSFileElement *)element

Parameters

element

The SKGPSFileElement, result of parsing a GPS file using the SKGPSFilesService class.

Discussion

Renders a GPSFileElement on the map. The color of the rendered polyline can be set in the GPS file using the extensions, in the ‘color’ field. The color must be in RGBA format. Ex: FF0000FF.

Declared In

SKMapView+GPSFiles.h

– removeGPSFileElement:

Removes a GPSFileElement from the map.

- (BOOL)removeGPSFileElement:(SKGPSFileElement *)element

Parameters

element

The previously drawn SKGPSFileElement, result of parsing a GPS file using the SKGPSFilesService class.

Discussion

Removes a GPSFileElement from the map.

Declared In

SKMapView+GPSFiles.h

– fitGPSFileElement:

Fits a previously drawn GPSFileElement on the map, in order to be visible.

- (void)fitGPSFileElement:(SKGPSFileElement *)element

Parameters

element

The previously drawn SKGPSFileElement, result of parsing a GPS file using the SKGPSFilesService class.

Discussion

Fits a previously drawn GPSFileElement on the map, in order to be visible.

Declared In

SKMapView+GPSFiles.h

Overlays Methods

– addPolygon:

Adds a polygon overlay on the map.

- (BOOL)addPolygon:(SKPolygon *)polygon

Parameters

polygon

Stores all the information about the polygon.

Return Value

The result of the operation.

Discussion

Adds a polygon overlay on the map.

Declared In

SKMapView+Overlays.h

– addPolyline:

Adds a polyline overlay on the map.

- (BOOL)addPolyline:(SKPolyline *)polyline

Parameters

polyline

Stores all the information about the polyline.

Return Value

The result of the operation.

Discussion

Adds a polyline overlay on the map.

Declared In

SKMapView+Overlays.h

– addCircle:

Adds a circle overlay on the map.

- (BOOL)addCircle:(SKCircle *)circle

Parameters

circle

Stores all the information about the circle.

Return Value

The result of the operation.

Discussion

Adds a circle overlay on the map.

Declared In

SKMapView+Overlays.h

– clearOverlayWithIdentifier:

Removes an overlay from the map.

- (BOOL)clearOverlayWithIdentifier:(NSInteger)overlayID

Parameters

overlayID

The id of the overlay that needs to be deleted.

Return Value

Succes/Failure of removing the overlay.

Discussion

Removes an overlay from the map.

Declared In

SKMapView+Overlays.h

– clearAllOverlays

Removes all overlays from the map.

- (void)clearAllOverlays

Discussion

Removes all overlays from the map.

Declared In

SKMapView+Overlays.h

HeatMaps Methods

– showHeatMapWithPOITypes:

Renders a heat map based on a list of POI categories.

- (void)showHeatMapWithPOITypes:(NSArray<NSNumber*> *)poiTypes

Parameters

poiTypes

An array of NSNumbers representing SKPOICategory elements for the HeatMap.

Discussion

Renders a heat map based on a list of POI categories.

Declared In

SKMapView+HeatMaps.h

– clearHeatMap

Clears the previously added HeatMap.

- (void)clearHeatMap

Discussion

Clears the previously added HeatMap.

Declared In

SKMapView+HeatMaps.h

Style Methods

+ mapStyle

Returns the current map style.

+ (SKMapViewStyle *)mapStyle

Discussion

Returns the current map style.

Declared In

SKMapView+Style.h

+ setMapStyle:

Sets the map style for all SKMapView instances.

+ (BOOL)setMapStyle:(SKMapViewStyle *)mapStyle

Parameters

mapStyle

The map style to be changed to.

Return Value

Success or failure of setting the new map style.

Discussion

Sets the map style for all SKMapView instances.

Declared In

SKMapView+Style.h

+ parseAlternativeMapStyle:asynchronously:

Parses a new style JSON file. After the parsing is finished, the kSKMapStyleParsingFinishedNotification is sent.

+ (BOOL)parseAlternativeMapStyle:(SKMapViewStyle *)alternativeStyle asynchronously:(BOOL)asynchronously

Parameters

alternativeStyle

The alternative style to be parsed.

asynchronously

If YES, the style will be parsed asynchronously, else it will be synchronously.

Return Value

Success or failure of parsing the new map style. Failure can occur if the style is not valid or if the app is in background.

Discussion

Parses a new style JSON file. After the parsing is finished, the kSKMapStyleParsingFinishedNotification is sent.

Declared In

SKMapView+Style.h

+ loadAlternativeMapStyle:

Loads a parsed alternative style into memory. The alternative style is set at initialisation, using mapStyleAlternative property of SKMapsInitSettings. After loading use useAlternativeMapStyle: method for activating/deactivating the usage of the alternative style.

+ (BOOL)loadAlternativeMapStyle:(SKMapViewStyle *)alternativeStyle

Parameters

alternativeStyle

The alternative style to be loaded.

Return Value

Success or failure of loading the new map style. Failure can occur if the style is not valid or if the app is in background.

Discussion

Loads a parsed alternative style into memory. The alternative style is set at initialisation, using mapStyleAlternative property of SKMapsInitSettings. After loading use useAlternativeMapStyle: method for activating/deactivating the usage of the alternative style.

Declared In

SKMapView+Style.h

+ useAlternativeMapStyle:

Activates/deactivates the usage of alternative map style, loaded with loadAlternativeMapStyle. The alternative map style should be used if multiple and often map style changes are required (ex: change the map to a red style when a speedcam is around , etc).

+ (BOOL)useAlternativeMapStyle:(BOOL)useAlternative

Parameters

useAlternative

YES in case the alternative map style should be used

Return Value

Success or failure of using the new map style. Failure can occur if the style is not valid or if the app is in background.

Discussion

Activates/deactivates the usage of alternative map style, loaded with loadAlternativeMapStyle. The alternative map style should be used if multiple and often map style changes are required (ex: change the map to a red style when a speedcam is around , etc).

Declared In

SKMapView+Style.h

+ unloadAlternativeMapStyle

Unloads the alternative style from memory. (loaded with loadAlternativeMapStyle).

+ (void)unloadAlternativeMapStyle

Discussion

Unloads the alternative style from memory. (loaded with loadAlternativeMapStyle).

Declared In

SKMapView+Style.h

+ removeStyle:

Disposes the memory of a in memory loaded map style.

+ (void)removeStyle:(SKMapViewStyle *)alternativeStyle

Parameters

alternativeStyle

The alternative style to be removed.

Discussion

Disposes the memory of a in memory loaded map style.

Declared In

SKMapView+Style.h