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;

        

    }

  • 相关阅读:
    Intellij IDEA 常用快捷键
    @Transient注解----Hiberbate
    tomcat:域名指向项目名
    java实现全排列
    Bean不同配置方式的比较
    Spring MVC:在jsp中引入css
    Spring中Bean的作用域
    第9章 初识HAL固件库
    第8章 自己写库—构建库函数雏形
    第7章 使用寄存器点亮LED灯
  • 原文地址:https://www.cnblogs.com/yevgeni/p/5579269.html
Copyright © 2011-2022 走看看