KNMapMarker
INFO
This English reference is based on Directions SDK 1.12.12. For the latest version, see the Korean reference.
Configures a Marker that indicates a specific location on the map. You can provide a custom image; otherwise, the default pin image appears. To add a Marker to the map, create a KNMapMarker object and register it with KNMapView.
Properties
| Name | Description | Type |
|---|---|---|
coordinate; | KATEC coordinates where the Marker appears (default: 0, due north relative to the screen) | @property (nonatomic, assign) FloatPoint coordinate; |
pixelOffset; | Pixel offset of the marker image, expressed as (x, y). The origin is the bottom center of the marker; +1 on x moves the image right and +1 on y moves it down. (default: origin) | @property (nonatomic, assign) IntPoint pixelOffset; |
priority; | Display priority of the marker. A higher number is displayed on top. (default: 0, priority range: 0~65535) | @property (nonatomic, assign) NSInteger priority; |
icon; | Marker image. You can set the marker image directly; if no image is set, the default pin image is displayed. | @property (nonatomic, assign, nonnull) UIImage* icon; |
isVisible; | Whether the marker is visible. (default: YES) | @property (nonatomic, assign) BOOL isVisible; |
tag; | Tag assigned to the marker (tag)The tag takes an Integer value and can be used to group markers or to identify them separately. (optional) | @property (nonatomic, assign) NSInteger tag; |
info; | Container object that stores information associated with the Marker (optional) | @property (nonatomic, assign, nullable) NSObject* info; |
title; | Title of the Marker callout bubble. Use updateCalloutBubble to set the primary title. | @property (nonatomic, readonly, nullable) NSString* title; |
subTitle; | Subtitle of the Marker callout bubble. Use updateCalloutBubble to set the subtitle. | @property (nonatomic, readonly, nullable) NSString* subTitle; |
isVisibleCalloutBubble; | Whether the Marker callout bubble is visible. | @property (nonatomic, assign) BOOL isVisibleCalloutBubble; |
useSingleTapped | Whether single-tap events are enabled. If NO, KNMarkerEventListener does not receive single-tap events. (default: YES) | @property (nonatomic, readwrite, assign) bool useSingleTapped |
useDoubleTapped | Whether double-tap events are enabled. If NO, KNMarkerEventListener does not receive double-tap events. (default: YES) | @property (nonatomic, readwrite, assign) bool useDoubleTapped |
useLongPressed | Whether long-press events are enabled. If NO, KNMarkerEventListener does not receive long-press events. (default: YES) | @property (nonatomic, readwrite, assign) bool useLongPressed |
Example code — Using KNMapMarker properties
// KATEC coordinates where the marker is displayed
marker.coordinate = newValue;
FloatPoint coordinate = marker.coordinate;
// Icon pixel offset. Moves the icon up by half its size so that the center of the marker icon is placed at the coordinate. (Origin: bottom center of the marker)
marker.pixelOffset = IntPointMake(0, -marker.icon.size.height*0.5);
IntPoint pixelOffset= marker.pixelOffset;
// Set the display priority of the marker
marker.priority = newValue;
NSInteger priority = marker.priority;
// Set the marker image
marker.icon = newImage;
UIImage* iconImage = marker.icon;
// Set whether to show the marker
marker.isVisible = newValue;
BOOL visible = marker.isVisible;
// Tag for the marker
marker.tag = newValue;
NSInteger tag = marker.tag;
// Attach data related to the marker
MarkerSpecialInfo* markerInfo = [[MarkerSpecialInfo alloc] init];
markerInfo.text = @"hiding it depends on the zoom level.";
// Set an arbitrary zoom level
markerInfo.maxVisibleZoom = 5.0;
marker.info = markerInfo;Constructor
+ marker
Creates a KNMapMarker object with default values.
+(KNMapMarker*)markerExample code — + marker
// Center position of the current map
FloatPoint pos = FloatPointMake(self->mapView.coordinateCenter.x, self->mapView.coordinateCenter.y);
// Create a default pin marker and add it to the map
KNMapMarker* marker = [KNMapMarker markerWithCoordinate:pos];
marker.priority = PRIORITY;
marker.tag = MARKER_01;
[self->mapView addMarker:marker];init(coordinate : FloatPoint)
Creates a KNMapMarker object initialized with the specified KATEC coordinates.
Example code — init(coordinate : FloatPoint)
IntPoint mapPos = [[KNSDK sharedInstance] convertWGS84ToKATECWithLongitude:127.110226 latitude:37.394259];
// Marker icon
UIImage* icPin = [UIImage imageNamed:@"icPin00@3x.png"];
// Create a marker and add it to the map
KNMapMarker* marker = [KNMapMarker markerWithCoordinate:FloatPointMakeWithIntPoint(mapPos)];
marker.priority = PRIORITY;
marker.tag = MARKER_02;
marker.icon = icPin;
// Adjust the offset because the icon is circular and its origin is at the bottom center.
marker.pixelOffset = IntPointMake(0, icPin.size.height*0.5);
[self->mapView addMarker:marker];Methods
animateWithCoordinate:duration
Moves the Marker on the map with an animation.
FloatPoint pos = FloatPointMake(self->mapView.coordinateCenter.x, self->mapView.coordinateCenter.y);
[marker animateWithCoordinate:pos duration:1000];- (void) animateWithCoordinate: (FloatPoint) aCoordinate
duration: (float) aDurationParameters
| Name | Description |
|---|---|
aCoodinate | KATEC coordinates of the location to move to |
aDuration | Animation duration(unit: ms) |
setVisibleRangeWithMinZoom:maxZoom
Sets the Zoom level range in which the Marker is visible. Use this method to hide the Marker outside a specific Zoom level range.
- (void) setVisibleRangeWithMinZoom: (float) aMinZoom
maxZoom: (float) aMaxZoomParameters
| Name | Description |
|---|---|
aMinZoom | Minimum Zoom level at which the Marker is visible |
aMaxZoom | Maximum Zoom level at which the Marker is visible |
updateCalloutBubble
Updates the Marker callout bubble using the settings in KNMapCalloutBubbleUpdate.
- (void) updateCalloutBubble: (KNMapCalloutBubbleUpdate* _Nonnull) aCalloutBubbleUpdate;Parameters
| Name | Description |
|---|---|
aCalloutBubbleUpdate | Callout bubble update settings |