zoukankan      html  css  js  c++  java
  • MKMapViewDelegate

    Responding to Map Position Changes

    - (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated//将要改变region时调用。如果scroll则会调用很多次
    - (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated//region改变后调用。如果scroll则会调用很多次
    

    Loading the Map Data

    - (void)mapViewWillStartLoadingMap:(MKMapView *)mapView//开始下载地图块(map tiles)时候调用
    - (void)mapViewDidFinishLoadingMap:(MKMapView *)mapView//地图下载完成块时调用
    - (void)mapViewDidFailLoadingMap:(MKMapView *)mapView withError:(NSError *)error//地图下载出错时调用,网络问题、前一个下载未完成等
    - (void)mapViewWillStartRenderingMap:(MKMapView *)mapView//开始渲染下载的地图块时调用
    - (void)mapViewDidFinishRenderingMap:(MKMapView *)mapView fullyRendered:(BOOL)fullyRendered//渲染结束时调用。fullyRendered:是否成功渲染

    Tracking the User Location

    - (void)mapViewWillStartLocatingUser:(MKMapView *)mapView//将要获取用户位置。showsUserLocation设为YES后调用
    - (void)mapViewDidStopLocatingUser:(MKMapView *)mapView//showsUserLocation设为NO后调用
    - (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation//用户位置更新或者Head更新时调用。后台运行不会调用
    - (void)mapView:(MKMapView *)mapView didFailToLocateUserWithError:(NSError *)error//尝试锁定用户位置失败
    - (void)mapView:(MKMapView *)mapView didChangeUserTrackingMode:(MKUserTrackingMode)mode animated:(BOOL)animated//改变UserTrackingMode

    didUpdateUserLocation:This method is not called if the application is currently running in the background. If you want to receive location updates while running in the background, you must use the Core Location framework.

     

    Managing Annotation Views

    - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation//设置annotation的View
    - (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views//地图上加上了annotationViews后调用
    - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control//Tap a anotationView's accessory button后调用

    If the object in the annotation parameter is an instance of the MKUserLocation class, you can provide a custom view to denote the user’s location. To display the user’s location using the default system view, return nil.

    If you do not implement this method, or if you return nil from your implementation for annotations other than the user location annotation, the map view uses a standard pin annotation view.

     

    Dragging an Annotation View

    - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)annotationView
    didChangeDragState:(MKAnnotationViewDragState)newState fromOldState:(MKAnnotationViewDragState)oldState
    //移动annotation位置时调用。state为宏,表示几个状态。是否能移动位置在annotation中设置。

    MKAnnotationViewDragStateStarting:拿起

    MKAnnotationViewDragStateDragging:开始拖拽

    MKAnnotationViewDragStateEnding:放下

    Selecting Annotation Views

    - (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view//选择了一个annotationView
    - (void)mapView:(MKMapView *)mapView didDeselectAnnotationView:(MKAnnotationView *)view//取消选择了一个annotationView
    

    Managing the Display of Overlays

    - (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id<MKOverlay>)overlay//设置overlay的渲染
    - (void)mapView:(MKMapView *)mapView didAddOverlayRenderers:(NSArray *)renderers//地图上加上了overlayRenderers后调用
    - (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id<MKOverlay>)overlay//同上面。IOS7.0后不使用
    - (void)mapView:(MKMapView *)mapView didAddOverlayViews:(NSArray *)overlayViews//同上面。IOS7.0后不使用
  • 相关阅读:
    数据类型之集合
    数据类型之字典
    数据类型之元组
    数据类型之列表
    python基础之数据类型转换
    python基础之格式化输出
    python基础之运算符、if条件语句、while循环、for循环
    廖雪峰大神git学习笔记
    elementui记录
    从零开始创建一个react项目
  • 原文地址:https://www.cnblogs.com/zhongriqianqian/p/3979352.html
Copyright © 2011-2022 走看看