首页 > 移动平台 > 详细

iosiOS 地图 自定义以及添加锚点

时间:2016-06-13 01:08:51      阅读:337      评论:0      收藏:0      [点我收藏+]

- (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;

    

}

iosiOS 地图 自定义以及添加锚点

原文:http://www.cnblogs.com/yevgeni/p/5579269.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!