HereSDKMapView
@interface HereSDKMapView : UIView
A UIView subclass for displaying a geographical map Map titles localization based on HereSDKManager.sharedManager.userPreferences.locale value at init time.
-
The geographic coordinates at the center of the map view.
Changing the value of this property centers the map on the new coordinates without changing the current zoom level.
Changing the value of this property updates the map view immediately. To change the view with a gradual animation, use the
-setCenterCoordinate:animated:
method instead.Declaration
Objective-C
@property (assign, readwrite, nonatomic) CLLocationCoordinate2D centerCoordinate;
Swift
var centerCoordinate: CLLocationCoordinate2D { get set }
-
Changes the center coordinate of the map and optionally animates the change.
Changing the center coordinate centers the map on the new coordinate without changing the current zoom level.
Declaration
Objective-C
- (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate animated:(BOOL)animated;
Swift
func setCenter(_ coordinate: CLLocationCoordinate2D, animated: Bool)
Parameters
coordinate
The new center coordinate for the map.
animated
Specify
YES
if you want the map view to scroll to the new location, orNO
if you want the map to display the new location immediately. -
The zoom level of the map view.
Zoom levels range from 0 (farthest camera) to 21 (closest camera) Changing the value of this property changes the zoom level of the map without changing the center coordinate.
Changing the value of this property updates the map view immediately. To animate the change in zoom, use the
-setZoom:animated:
method instead.Declaration
Objective-C
@property (assign, readwrite, nonatomic) float zoom;
Swift
var zoom: Float { get set }
-
Changes the zoom level of the map and optionally animates the change.
Changes the zoom level of the map without changing the center coordinate.
Declaration
Objective-C
- (void)setZoom:(float)zoom animated:(BOOL)animated;
Swift
func setZoom(_ zoom: Float, animated: Bool)
Parameters
zoom
The new zoom level for the map.
animated
Specify
YES
if you want the map view animate to the new zoom level, orNO
if you want the map to display the new zoom level immediately. -
The rotation of the map, measured in radians clockwise from true north.
The value
0
means that the top edge of the map view corresponds to true north.Changing the value of this property updates the map view immediately. To animate the change, use the
-setRotation:animated:
method instead.Declaration
Objective-C
@property (assign, readwrite, nonatomic) float rotation;
Swift
var rotation: Float { get set }
-
Changes the rotation of the map and optionally animates the change.
Declaration
Objective-C
- (void)setRotation:(float)rotation animated:(BOOL)animated;
Swift
func setRotation(_ rotation: Float, animated: Bool)
Parameters
rotation
The rotation of the map, measured in radians clockwise from true north.
animated
Specify
YES
to animate the change to the new rotation, orNO
to display the new rotation immediately. -
The max tilt angle of the map
camera
, measured in radians. Default is 1.309 radians (75 degrees).Changing the value of the property limits user interaction for tilt. If the current map tilt exceeds the new
maxTilt
, the map tilt is adjusted immediately. To animate the change, use the-setMaxTilt:animated:
method instead.Declaration
Objective-C
@property (assign, readwrite, nonatomic) float maxTilt;
Swift
var maxTilt: Float { get set }
-
Changes the maximum tilt angle of the map
camera
, measured in radians.Declaration
Objective-C
- (void)setMaxTilt:(float)maxTilt animated:(BOOL)animated;
Swift
func setMaxTilt(_ maxTilt: Float, animated: Bool)
Parameters
maxTilt
The maximum tilt angle of the map camera, measured in radians. Will be clamped between 0 and 90 degrees (1.5708 radians)
animated
Specify
YES
, if the map should animate to an adjusted tilt after setting a smallermaxTilt
than the current tilt angle of the map -
The tilt angle of the map
camera
, measured in radians from the 0 direction (0 direction = camera is facing the ground).Changing the value of this property updates the map view immediately. To animate the change, use the
-setTilt:animated:
method instead.Can not exceed
maxTilt
.Declaration
Objective-C
@property (assign, readwrite, nonatomic) float tilt;
Swift
var tilt: Float { get set }
-
Changes the tilt angle of the map
camera
, and optionally animates the change.Declaration
Objective-C
- (void)setTilt:(float)tilt animated:(BOOL)animated;
Swift
func setTilt(_ tilt: Float, animated: Bool)
Parameters
tilt
The tilt angle of the map camera, measured in radians. Can not exceed
maxTilt
.animated
Specify
YES
to animate to the change to the new tilt angle, orNO
to display the new tilt angle immediately. -
A Boolean value that determines whether the user may zoom the map in and out, changing the zoom level.
When this property is set to
YES
(the default) the user may zoom the map in and out by pinching two fingers or by double tapping (tapping with two fingers).This property controls only user interactions with the map. If the property is set to
NO
, you can still change the map zoom programmatically.Declaration
Objective-C
@property (getter=isZoomEnabled, assign, readwrite, nonatomic) BOOL zoomEnabled;
Swift
var isZoomEnabled: Bool { get set }
-
A Boolean value that determines whether the user may tilt the map back and forth, changing the tilt level.
When this property is set to
YES
(the default) the user may tilt the map back and forth by draging with two fingers.This property controls only user interactions with the map. If the property is set to
NO
, you can still change the map tilt programmatically.Declaration
Objective-C
@property (getter=isTiltEnabled, assign, readwrite, nonatomic) BOOL tiltEnabled;
Swift
var isTiltEnabled: Bool { get set }
-
A Boolean value that determines whether the user may rotate the map, changing the rotation level.
When this property is set to
YES
(the default) the user may rotate the map by rotating with two fingers.This property controls only user interactions with the map. If the property is set to
NO
, you can still change the map rotation programmatically.Declaration
Objective-C
@property (getter=isRotationEnabled, assign, readwrite, nonatomic) BOOL rotationEnabled;
Swift
var isRotationEnabled: Bool { get set }
-
A Boolean value that determines whether the user may drag/scroll the map, changing the map region.
When this property is set to
YES
(the default) the user may scroll the map by dragging/swiping with one finger.This property controls only user interactions with the map. If the property is set to
NO
, you can still change the map position programmatically.Declaration
Objective-C
@property (getter=isScrollEnabled, assign, readwrite, nonatomic) BOOL scrollEnabled;
Swift
var isScrollEnabled: Bool { get set }
-
The receiver’s delegate, for handling map view changes.
A map view sends messages to its delegate to notify it of changes to its contents.
Declaration
Objective-C
@property (readwrite, nonatomic, nullable) id<HereSDKMapViewDelegate> delegate;
Swift
weak var delegate: HereSDKMapViewDelegate? { get set }
-
Undocumented
Declaration
Objective-C
@property (nonatomic, readonly) NSArray<HereSDKPolyline *>* polylines
Swift
var polylines: [HereSDKPolyline] { get }
-
Undocumented
Declaration
Objective-C
- (void)addPolyline:(HereSDKPolyline *)polyline;
Swift
func addPolyline(_ polyline: HereSDKPolyline)
-
Undocumented
Declaration
Objective-C
- (void)addPolyline:(HereSDKPolyline *)polyline withStyle:(HereSDKPolylineStyle *)style;
Swift
func addPolyline(_ polyline: HereSDKPolyline, with style: HereSDKPolylineStyle)
-
Undocumented
Declaration
Objective-C
- (void)removePolyline:(HereSDKPolyline *)polyline;
Swift
func removePolyline(_ polyline: HereSDKPolyline)
-
Undocumented
Declaration
Objective-C
- (void)removePolylines:(NSArray<HereSDKPolyline *> *)polylines;
Swift
func removePolylines(_ polylines: [HereSDKPolyline])
-
Undocumented
Declaration
Objective-C
@property (nonatomic, readonly) NSArray<HereSDKPolygon *>* polygons
Swift
var polygons: [HereSDKPolygon] { get }
-
Undocumented
Declaration
Objective-C
- (void)addPolygon:(HereSDKPolygon *)polygon;
Swift
func addPolygon(_ polygon: HereSDKPolygon)
-
Undocumented
Declaration
Objective-C
- (void)addPolygon:(HereSDKPolygon *)polygon withStyle:(HereSDKFeatureStyle *)style;
Swift
func addPolygon(_ polygon: HereSDKPolygon, with style: HereSDKFeatureStyle)
-
Undocumented
Declaration
Objective-C
- (void)removePolygon:(HereSDKPolygon *)polygon;
Swift
func removePolygon(_ polygon: HereSDKPolygon)
-
Undocumented
Declaration
Objective-C
- (void)removePolygons:(NSArray<HereSDKPolygon *> *)polygons;
Swift
func removePolygons(_ polygons: [HereSDKPolygon])
-
Changes the receiver’s viewport to fit the given coordinate bounds, optionally animating the change.
Declaration
Objective-C
- (BOOL)setVisibleMapRect:(HereSDKMapRect)mapRect animated:(BOOL)animated;
Swift
func setVisibleMapRect(_ mapRect: HereSDKMapRect, animated: Bool) -> Bool
Parameters
mapRect
The bounds that the viewport will show in its entirety.
animated
Specify
YES
to animate the change by smoothly scrolling and zooming, orNO
to immediately display the given bounds.Return Value
YES
, if coordinate bounds are valid and can be set. Otherwise returnsNO
. The method returns immediately. -
Changes the receiver’s viewport to fit the given coordinate bounds with additional padding on each side, optionally animating the change.
Declaration
Objective-C
- (BOOL)setVisibleMapRect:(HereSDKMapRect)mapRect edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated;
Swift
func setVisibleMapRect(_ mapRect: HereSDKMapRect, edgePadding insets: UIEdgeInsets, animated: Bool) -> Bool
Parameters
mapRect
The bounds that the viewport will show in its entirety.
insets
The minimum padding (in screen points) that will be visible around the given coordinate bounds.
animated
Specify
YES
to animate the change by smoothly scrolling and zooming, orNO
to immediately display the given bounds.Return Value
YES
, if coordinate bounds are valid and can be set. Otherwise returnsNO
. The method returns immediately. -
Annotations array that allows you to add your content with specific map locations.
Declaration
Objective-C
@property (readonly, nonatomic) NSArray<id<HereSDKAnnotation>> *_Nonnull annotations;
-
Adds the specified annotation to the map view
Declaration
Objective-C
- (void)addAnnotation:(nonnull id<HereSDKAnnotation>)annotation;
Parameters
annotation
Annotation to be added to the annotations array
-
Removes the specified annotation from the map view.
Declaration
Objective-C
- (void)removeAnnotation:(nonnull id<HereSDKAnnotation>)annotation;
Parameters
annotation
Annotation to be removed from the annotations array
-
A set of currently selected annotations;
Declaration
Objective-C
@property (readonly, nonatomic) NSSet<id<HereSDKAnnotation>> *_Nonnull selectedAnnotations;
-
Selects the specified annotation and displays a selected view for it.
If the annotation doesn’t provide a title or subtitle or the mapView’s delegate does not provide a
selectedViewForAnnotation
, this method does nothing.Declaration
Objective-C
- (void)selectAnnotation:(nonnull id<HereSDKAnnotation>)annotation;
Parameters
annotation
Annotation to be selected
-
Deselects the specified annotation and hides the selected view for it. If the annotation is currently not selected, this method does nothing.
Declaration
Objective-C
- (void)deselectAnnotation:(nonnull id<HereSDKAnnotation>)annotation;
Parameters
annotation
Annotation to be deselected
-
Annotation that represents the user location on map.
nil
if not present.Declaration
Objective-C
@property (readonly, nonatomic, nullable) HereSDKUserLocationAnnotation *userLocationAnnotation;
Swift
var userLocationAnnotation: HereSDKUserLocationAnnotation? { get }
-
Shows or hides the user location on the map.
Declaration
Objective-C
- (void)showUserLocation:(BOOL)shouldShowUserLocation;
Swift
func showUserLocation(_ shouldShowUserLocation: Bool)
Parameters
shouldShowUserLocation
Boolean value that indicates whether the map should try to display the user’s location.
-
Setting this value, changes the visibility of the compass indicator in the map view. Default is
HereSDKMapCompassVisibiltyWhenRotated
.Declaration
Objective-C
@property (assign, readwrite, nonatomic) HereSDKMapCompassVisibility compassVisibilty;
Swift
var compassVisibilty: HereSDKMapCompassVisibility { get set }
-
Setting this value, adjusts the position of the compass indicator in the map view. Default is
HereSDKMapCompassPositionTopRight
.Declaration
Objective-C
@property (assign, readwrite, nonatomic) HereSDKMapCompassPosition compassPosition;
Swift
var compassPosition: HereSDKMapCompassPosition { get set }
-
Setting this value, updates the compass indicator with a custom image.
@Note: to remove the compass, use the
compassVisibility
property.Declaration
Objective-C
- (void)setCompassImage:(nullable UIImage *)compassImage;
Swift
func setCompassImage(_ compassImage: UIImage?)
Parameters
compassImage
The image for the compass indicator. If this value is
nil
, the compass will use the standard compass image. -
Adjusts the inset of map accessory views (like the compass indicator view).
Declaration
Objective-C
@property (assign, readwrite, nonatomic) UIEdgeInsets contentInsets;
Swift
var contentInsets: UIEdgeInsets { get set }
-
Changes the center coordinate of the map with the specified duration and
HereSDKAnimationCurveCubic
animation type.Changing the center coordinate centers the map on the new coordinate without changing the current zoom level.
Declaration
Objective-C
- (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate withDuration:(NSTimeInterval)duration;
Swift
func setCenter(_ coordinate: CLLocationCoordinate2D, withDuration duration: TimeInterval)
Parameters
coordinate
The new center coordinate for the map.
duration
The time interval/duration of the animation.
-
Changes the center coordinate of the map with the specified duration and animation type.
Changing the center coordinate centers the map on the new coordinate without changing the current zoom level.
Declaration
Objective-C
- (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate withDuration:(NSTimeInterval)duration animationCurve:(HereSDKMapAnimationCurve)animationCurve;
Swift
func setCenter(_ coordinate: CLLocationCoordinate2D, withDuration duration: TimeInterval, animationCurve: HereSDKMapAnimationCurve)
Parameters
coordinate
The new center coordinate for the map.
duration
The time interval/duration of the animation.
animationCurve
The animation type for the change. Defines the animation curve and ease type for the change.
-
Changes the zoom level of the map with the specified duration and
HereSDKAnimationCurveCubic
animation type.Changes the zoom level of the map without changing the center coordinate.
Declaration
Objective-C
- (void)setZoom:(float)zoom withDuration:(NSTimeInterval)duration;
Swift
func setZoom(_ zoom: Float, withDuration duration: TimeInterval)
Parameters
zoom
The new zoom level for the map.
duration
The time interval/duration of the animation.
-
Changes the zoom level of the map with the specified duration and animation type.
Changes the zoom level of the map without changing the center coordinate.
Declaration
Objective-C
- (void)setZoom:(float)zoom withDuration:(NSTimeInterval)duration animationCurve:(HereSDKMapAnimationCurve)animationCurve;
Swift
func setZoom(_ zoom: Float, withDuration duration: TimeInterval, animationCurve: HereSDKMapAnimationCurve)
Parameters
zoom
The new zoom level for the map.
duration
The time interval/duration of the animation.
animationCurve
The animation type for the change. Defines the animation curve and ease type for the change.
-
Changes the rotation of the map with the specified duration and
HereSDKAnimationCurveCubic
animation type.Changes the rotation of the map without changing the center coordinate.
Declaration
Objective-C
- (void)setRotation:(float)rotation withDuration:(NSTimeInterval)duration;
Swift
func setRotation(_ rotation: Float, withDuration duration: TimeInterval)
Parameters
rotation
The rotation of the map, measured in radians clockwise from true north.
duration
The time interval/duration of the animation.
-
Changes the rotation of the map with the specified duration and animation type.
Changes the rotation of the map without changing the center coordinate.
Declaration
Objective-C
- (void)setRotation:(float)rotation withDuration:(NSTimeInterval)duration animationCurve:(HereSDKMapAnimationCurve)animationCurve;
Swift
func setRotation(_ rotation: Float, withDuration duration: TimeInterval, animationCurve: HereSDKMapAnimationCurve)
Parameters
rotation
The rotation of the map, measured in radians clockwise from true north.
duration
The time interval/duration of the animation.
animationCurve
The animation type for the change. Defines the animation curve and ease type for the change.
-
Changes the tilt angle of the map
camera
with the specified duration andHereSDKAnimationCurveCubic
animation type.Changes the rotation of the map without changing the center coordinate.
Declaration
Objective-C
- (void)setTilt:(float)tilt withDuration:(NSTimeInterval)duration;
Swift
func setTilt(_ tilt: Float, withDuration duration: TimeInterval)
Parameters
tilt
The tilt angle of the map camera, measured in radians. Can not exceed
maxTilt
.duration
The time interval/duration of the animation.
-
Changes the tilt angle of the map
camera
with the specified duration and animation type.Changes the rotation of the map without changing the center coordinate.
Declaration
Objective-C
- (void)setTilt:(float)tilt withDuration:(NSTimeInterval)duration animationCurve:(HereSDKMapAnimationCurve)animationCurve;
Swift
func setTilt(_ tilt: Float, withDuration duration: TimeInterval, animationCurve: HereSDKMapAnimationCurve)
Parameters
tilt
The tilt angle of the map camera, measured in radians. Can not exceed
maxTilt
.duration
The time interval/duration of the animation.
animationCurve
The animation type for the change. Defines the animation curve and ease type for the change.
-
Changes the receiver’s viewport to fit the given coordinate bounds with additional padding on each side with the specified duration and
HereSDKAnimationCurveCubic
animation type.Declaration
Objective-C
- (BOOL)setVisibleMapRect:(HereSDKMapRect)mapRect edgePadding:(UIEdgeInsets)insets withDuration:(NSTimeInterval)duration;
Swift
func setVisibleMapRect(_ mapRect: HereSDKMapRect, edgePadding insets: UIEdgeInsets, withDuration duration: TimeInterval) -> Bool
Parameters
mapRect
The bounds that the viewport will show in its entirety.
insets
The minimum padding (in screen points) that will be visible around the given coordinate bounds.
duration
The time interval/duration of the animation.
Return Value
YES
, if coordinate bounds are valid and can be set. Otherwise returnsNO
. The method returns immediately. -
Changes the receiver’s viewport to fit the given coordinate bounds with additional padding on each side with the specified duration and animation type.
Declaration
Objective-C
- (BOOL)setVisibleMapRect:(HereSDKMapRect)mapRect edgePadding:(UIEdgeInsets)insets withDuration:(NSTimeInterval)duration animationCurve:(HereSDKMapAnimationCurve)animationCurve;
Swift
func setVisibleMapRect(_ mapRect: HereSDKMapRect, edgePadding insets: UIEdgeInsets, withDuration duration: TimeInterval, animationCurve: HereSDKMapAnimationCurve) -> Bool
Parameters
mapRect
The bounds that the viewport will show in its entirety.
insets
The minimum padding (in screen points) that will be visible around the given coordinate bounds.
duration
The time interval/duration of the animation.
animationCurve
The animation type for the change. Defines the animation curve and ease type for the change.
Return Value
YES
, if coordinate bounds are valid and can be set. Otherwise returnsNO
. The method returns immediately.