ZMSMapViewDelegate
Objective-C
@protocol ZMSMapViewDelegate <NSObject>
                Swift
protocol ZMSMapViewDelegate : NSObjectProtocol
                地図イベントのデリゲート
- 
                  
                  
アニメーションやジェスチャーなどで、カメラの移動が開始される前にコールされる
Declaration
Objective-C
- (void)mapView:(nonnull ZMSMapView *)mapView willMove:(BOOL)gesture;Swift
optional func mapView(_ mapView: ZMSMapView, willMove gesture: Bool)Parameters
mapView:対象の地図
gesture:ユーザーによる操作(YES) / コードによる操作(NO)
 - 
                  
                  
アニメーション中やジェスチャー中など、カメラの移動時にコールされる
Note
移動中は繰り返し実行される。
アニメーション中は全てのカメラ位置で呼ばれるわけではないが、最後のカメラ位置では必ず呼び出される。Declaration
Objective-C
- (void)mapView:(nonnull ZMSMapView *)mapView didChangeCameraPosition:(nonnull ZMSCameraPosition *)position;Swift
optional func mapView(_ mapView: ZMSMapView, didChange position: ZMSCameraPosition)Parameters
mapView:対象の地図
position:カメラ位置情報
 - 
                  
                  
カメラの移動が完了した後、アイドル状態になった際にコールされる
Declaration
Objective-C
- (void)mapView:(nonnull ZMSMapView *)mapView idleAtCameraPosition:(nonnull ZMSCameraPosition *)position;Swift
optional func mapView(_ mapView: ZMSMapView, idleAt position: ZMSCameraPosition)Parameters
mapView:対象の地図
position:カメラ位置情報
 - 
                  
                  
任意の位置をタップした際にコールされる
Note
マーカー選択時は呼び出されないが、マーカが非選択状態になる際は呼び出される。Declaration
Objective-C
- (void)mapView:(nonnull ZMSMapView *)mapView didTapAtCoordinate:(CLLocationCoordinate2D)coordinate;Swift
optional func mapView(_ mapView: ZMSMapView, didTapAt coordinate: CLLocationCoordinate2D)Parameters
mapView:対象の地図
coordinate:座標(緯度/経度)
 - 
                  
                  
地図上の任意の位置を長押しするとコールされる
Declaration
Objective-C
- (void)mapView:(nonnull ZMSMapView *)mapView didLongPressAtCoordinate:(CLLocationCoordinate2D)coordinate;Swift
optional func mapView(_ mapView: ZMSMapView, didLongPressAt coordinate: CLLocationCoordinate2D)Parameters
mapView:対象の地図
coordinate:座標(緯度/経度)
 - 
                  
                  
マーカーがタップされるとコールされる
戻り値によってマーカーの選択状態を制御できる。
Note
デフォルト値: NODeclaration
Objective-C
- (BOOL)mapView:(nonnull ZMSMapView *)mapView didTapMarker:(nonnull ZMSMarker *)marker;Swift
optional func mapView(_ mapView: ZMSMapView, didTap marker: ZMSMarker) -> BoolParameters
mapView:対象の地図
marker:対象のマーカー
Return Value
マーカーを選択状態にしない(YES) / マーカーを選択状態にする(NO)
 - 
                  
                  
マーカーが選択された際にコールされる
このデリゲートでUIViewを返した場合、インフォウィンドウの代わりにそのUIViewが表示される。
Declaration
Objective-C
- (nullable UIView *)mapView:(nonnull ZMSMapView *)mapView markerInfoWindow:(nonnull ZMSMarker *)marker;Swift
optional func mapView(_ mapView: ZMSMapView, markerInfoWindow marker: ZMSMarker) -> UIView?Parameters
mapView:対象の地図
marker:対象のマーカー
Return Value
インフォウィンドウの代わりに表示するUIView
 - 
                  
                  
マーカーのインフォウィンドウをタップした際にコールされる
Declaration
Objective-C
- (void)mapView:(nonnull ZMSMapView *)mapView didTapInfoWindowOfMarker:(nonnull ZMSMarker *)marker;Swift
optional func mapView(_ mapView: ZMSMapView, didTapInfoWindowOf marker: ZMSMarker)Parameters
mapView:対象の地図
marker:対象のインフォウィンドウの親マーカー
 - 
                  
                  
マーカーのインフォウィンドウを長押しするとコールされる
Declaration
Objective-C
- (void)mapView:(nonnull ZMSMapView *)mapView didLongPressInfoWindowOfMarker:(nonnull ZMSMarker *)marker;Swift
optional func mapView(_ mapView: ZMSMapView, didLongPressInfoWindowOf marker: ZMSMarker)Parameters
mapView:対象の地図
marker:対象のインフォウィンドウの親マーカー
 - 
                  
                  
重畳物をタップした際にコールされる
Declaration
Objective-C
- (void)mapView:(nonnull ZMSMapView *)mapView didTapOverlays:(nonnull NSArray *)overlays;Swift
optional func mapView(_ mapView: ZMSMapView, didTapOverlays overlays: [Any])Parameters
mapView:対象の地図
overlays:タップされた位置に存在する重畳物のリスト
 - 
                  
                  
Deprecated
重畳物をタップした際にコールされる
Warning
廃止予定Declaration
Objective-C
- (void)mapView:(nonnull ZMSMapView *)mapView didTapOverlay:(nonnull ZMSOverlay *)overlay;Swift
optional func mapView(_ mapView: ZMSMapView, didTap overlay: ZMSOverlay)Parameters
mapView:対象の地図
overlay:タップされた位置に存在する重畳物
 - 
                  
                  
現在地ボタンがタップされた時にコールされる
戻り値によって現在地の移動を制御できる。
Note
デフォルト値: NODeclaration
Objective-C
- (BOOL)didTapMyLocationButtonForMapView:(nonnull ZMSMapView *)mapView;Swift
optional func didTapMyLocationButton(for mapView: ZMSMapView) -> BoolParameters
mapView:対象の地図
Return Value
現在地に移動しない(YES) / 現在地に移動する(NO)
 - 
                  
                  
移動範囲外へ出た時にコールされる
Declaration
Objective-C
- (void)mapView:(nonnull ZMSMapView *)mapView onOutOfArea:(nonnull ZMSCameraPosition *)camera;Swift
optional func mapView(_ mapView: ZMSMapView, onOutOfArea camera: ZMSCameraPosition)Parameters
mapView:対象の地図
camera:カメラ位置情報
 - 
                  
                  
地図内で発生したタッチイベント(TouchesBegan)をUIスレッド経由で中継する
Declaration
Objective-C
- (void)mapView:(nonnull ZMSMapView *)mapView touchesBegan:(nonnull NSSet *)touches withEvent:(nonnull UIEvent *)event;Swift
optional func mapView(_ mapView: ZMSMapView, touchesBegan touches: Set<AnyHashable>, with event: UIEvent)Parameters
mapView:対象の地図
touches:タッチ情報
event:イベント情報
 - 
                  
                  
地図内で発生したタッチイベント(TouchesMoved)をUIスレッド経由で中継する
Declaration
Objective-C
- (void)mapView:(nonnull ZMSMapView *)mapView touchesMoved:(nonnull NSSet *)touches withEvent:(nonnull UIEvent *)event;Swift
optional func mapView(_ mapView: ZMSMapView, touchesMoved touches: Set<AnyHashable>, with event: UIEvent)Parameters
mapView:対象の地図
touches:タッチ情報
event:イベント情報
 - 
                  
                  
地図内で発生したタッチイベント(TouchesEnded)をUIスレッド経由で中継する
Declaration
Objective-C
- (void)mapView:(nonnull ZMSMapView *)mapView touchesEnded:(nonnull NSSet *)touches withEvent:(nonnull UIEvent *)event;Swift
optional func mapView(_ mapView: ZMSMapView, touchesEnded touches: Set<AnyHashable>, with event: UIEvent)Parameters
mapView:対象の地図
touches:タッチ情報
event:イベント情報
 - 
                  
                  
地図内で発生したタッチイベント(TouchesCancelled)をUIスレッド経由で中継する
Declaration
Objective-C
- (void)mapView:(nonnull ZMSMapView *)mapView touchesCancelled:(nonnull NSSet *)touches withEvent:(nonnull UIEvent *)event;Swift
optional func mapView(_ mapView: ZMSMapView, touchesCancelled touches: Set<AnyHashable>, with event: UIEvent)Parameters
mapView:対象の地図
touches:タッチ情報
event:イベント情報
 - 
                  
                  
現在位置が変化した時にコールされる
Declaration
Objective-C
- (void)mapView:(nonnull ZMSMapView *)mapView didUpdateLocations:(CLLocationCoordinate2D)coord;Swift
optional func mapView(_ mapView: ZMSMapView, didUpdateLocations coord: CLLocationCoordinate2D)Parameters
mapView:対象の地図
coord:位置情報
 - 
                  
                  
端末の向きが変化した時にコールされる
Declaration
Objective-C
- (void)mapView:(nonnull ZMSMapView *)mapView didUpdateHeading:(CLLocationDirection)heading;Swift
optional func mapView(_ mapView: ZMSMapView, didUpdateHeading heading: CLLocationDirection)Parameters
mapView:対象の地図
heading:端末の向き
 
        ZMSMapViewDelegate Protocol Reference