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后不使用
  • 相关阅读:
    微服务实战系列(七)-网关springcloud gateway
    微服务实战系列(六)-网关springcloud zuul
    微服务实战系列(五)-注册中心Eureka与nacos区别
    微服务实战系列(四)-注册中心springcloud alibaba nacos
    中国唯一入选 Forrester 领导者象限,阿里云 Serverless 全球领先
    面对不可避免的故障,我们造了一个“上帝视角”的控制台
    实习就参与“服务过亿用户的项目”,是什么体验?
    Go Mysql Driver 集成 Seata-Golang 解决分布式事务问题
    云原生时代下,容器安全的“四个挑战”和“两个关键”
    OpenKruise v0.8.0 核心能力解读:管理 Sidecar 容器的利器
  • 原文地址:https://www.cnblogs.com/zhongriqianqian/p/3979352.html
Copyright © 2011-2022 走看看