YMKMapObject

@interface YMKMapObject : NSObject

An object displayed on the map.

Summary

Instance methods

- (void)setVisibleWithVisible:(BOOL)visible
                    animation:(nonnull YMKAnimation *)animation
                     callback:(nullable YMKCallback)callback;

Manages visibility of the object

- (void)addTapListenerWithTapListener:
    (nonnull id<YMKMapObjectTapListener>)tapListener;

Adds a tap listener to the object

- (void)removeTapListenerWithTapListener:
    (nonnull id<YMKMapObjectTapListener>)tapListener;

Removes the tap listener from the object

- (void)setDragListenerWithDragListener:
    (nullable id<YMKMapObjectDragListener>)dragListener;

Sets a drag listener for the object

Properties

@property (nonatomic, readonly, nonnull) YMKBaseMapObjectCollection *parent;
Returns the collection of map objects that the current map object belongs to

@property (nonatomic, assign, unsafe_unretained, readwrite, getter=isVisible)
    BOOL visible;

Manages visibility of the object on the map

@property (nonatomic, assign, unsafe_unretained, readwrite) float zIndex;
Gets the z-index, which affects: <ul><li>Rendering order

@property (nonatomic, assign, unsafe_unretained, readwrite, getter=isDraggable)
    BOOL draggable;

If true, the map object can be dragged by the user

@property (nonatomic, assign, unsafe_unretained, readwrite, nullable)
    id userData;

Use this property to attach any object-related metadata

@property (nonatomic, readonly, getter=isValid) BOOL valid;
Tells if this object is valid or no

Instance methods

setVisibleWithVisible:animation:callback:

- (void)setVisibleWithVisible:(BOOL)visible
                    animation:(nonnull YMKAnimation *)animation
                     callback:(nullable YMKCallback)callback;

Manages visibility of the object.

Parameters

animation

Describes the transition between visible and not visible states.

onFinished

Called when the transition is finished.


addTapListenerWithTapListener:

- (void)addTapListenerWithTapListener:
    (nonnull id<YMKMapObjectTapListener>)tapListener;

Adds a tap listener to the object.

The class does not retain the object in the 'tapListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.


removeTapListenerWithTapListener:

- (void)removeTapListenerWithTapListener:
    (nonnull id<YMKMapObjectTapListener>)tapListener;

Removes the tap listener from the object.


setDragListenerWithDragListener:

- (void)setDragListenerWithDragListener:
    (nullable id<YMKMapObjectDragListener>)dragListener;

Sets a drag listener for the object. Each object can only have one drag listener.

The class does not retain the object in the 'dragListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.


Properties

parent

@property (nonatomic, readonly, nonnull) YMKBaseMapObjectCollection *parent;

Returns the collection of map objects that the current map object belongs to.


visible

@property (nonatomic, assign, unsafe_unretained, readwrite, getter=isVisible)
    BOOL visible;

Manages visibility of the object on the map. Default: true.


zIndex

@property (nonatomic, assign, unsafe_unretained, readwrite) float zIndex;

Gets the z-index, which affects:

  • Rendering order.
  • Dispatching of UI events (taps and drags are dispatched to objects with higher z-indexes first).
Z-index is relative to the parent.


draggable

@property (nonatomic, assign, unsafe_unretained, readwrite, getter=isDraggable)
    BOOL draggable;

If true, the map object can be dragged by the user. Default: false.


userData

@property (nonatomic, assign, unsafe_unretained, readwrite, nullable)
    id userData;

Use this property to attach any object-related metadata.

Optional property, can be nil.


valid

@property (nonatomic, readonly, getter=isValid) BOOL valid;

Tells if this object is valid or no. Any method called on an invalid object will throw an exception. The object becomes invalid only on UI thread, and only when its implementation depends on objects already destroyed by now. Please refer to general docs about the interface for details on its invalidation.