zoukankan      html  css  js  c++  java
  • iosiOS 地图 自定义以及添加锚点

    - (void)clickLongPress:(UILongPressGestureRecognizer *)longPress {

        

        CGPoint point = [longPress locationInView:mapView];

        

        CLLocationCoordinate2D coord = [mapView convertPoint:point toCoordinateFromView:mapView];

        

        CLLocation *location = [[CLLocation alloc] initWithLatitude:coord.latitude longitude:coord.longitude];

        

        MKPointAnnotation *annocation = [[MKPointAnnotation alloc] init];

        

        annocation.coordinate = coord;

        

        annocation.title = @"我的锚点";

        

        [mapView addAnnotation:annocation];

    }

     //代理方法   签协议 

        MKMapViewDelegate

    -(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation{

        

        static NSString *annoid = @"str";

        

        MKAnnotationView *annoView = [mapView dequeueReusableAnnotationViewWithIdentifier:annoid];

        

        if (!annoView) {

            

            annoView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:annoid];

        }

        

        annoView.image = [UIImage imageNamed:@"1"];

        

        return annoView;

        

    }

  • 相关阅读:
    少儿编程之图形编程
    少儿编程是什么?要学吗?如何学?
    AlloyDesigner 使用
    轮播总结
    git实用攻略
    git subtree用法(转)
    vue 插值,v-once,v-text, v-html
    webpack的学习准备工作
    webstorm中github的配置
    less 安装和webstorm的使用
  • 原文地址:https://www.cnblogs.com/yevgeni/p/5579269.html
Copyright © 2011-2022 走看看