- (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 地图 自定义以及添加锚点的更多相关文章

  1. Android高德地图自定义Markers的例子

    下文为各位重点介绍关于Android高德地图自定义Markers的例子,希望这篇文章能够让各位理解到Android高德地图自定义Markers的方法. 之前的博客里说了地图的嵌入和定位,今天就说说在地 ...

  2. Swift之高德地图自定义标注弹出气泡样式

    在用到地图类的sdk,sdk自带的样式必定不能满足开发者的需求,于是开发者不得不进行自定义,由于官方同样是object-c 版语法,不得不将其转为swift语法,以满足项目需求. 新建两个类 Cust ...

  3. ueditor富文本编辑器使用百度地图自定义动态地图组件及兼容https及http协议

    ueditor富文本编辑器默认支持百度地图组件,但是如果导入动态地图后会加很多默认的地图组件在上面.如果需要自定义动态地图的组件则需要修改ueditor特定的html. ueditor百度地图组件所在 ...

  4. 百度地图自定义icon,定位偏移问题

    最近使用百度地图做一个调度系统,使用定义icon的marker,结果地图显示marker和实际位置偏移,最终参考文章: http://www.cnblogs.com/jz1108/archive/20 ...

  5. 【Android】百度地图自定义弹出窗口

    我们使用百度地图的时候,点击地图上的Marker,会弹出一个该地点详细信息的窗口,如下左图所示,有时候,我们希望自己定义这个弹出窗口的内容,或者,干脆用自己的数据来构造这样的弹出窗口,但是,在百度地图 ...

  6. 百度地图自定义Marker

    最近写了百度地图的Demo,所以总结下遇到的问题: 1.首先在百度地图中创建应用时用到 发布版SHA1是在Preferences下的Android下的Build中;2.在使用百度地图时,先要创建一个A ...

  7. iOS高德地图自定义annotation添加不同图片

    1.model类里面添加index #import <MAMapKit/MAMapKit.h> #import <AMapSearchKit/AMapCommonObj.h> ...

  8. echarts地图自定义任意区域

    这里可以直接在地图上框选区域,右侧会自动生成geojson

  9. 谷歌地图自定义popup框

    谷歌地图的infowindow 不提供官方的定制化 <!DOCTYPE html> <html> <head> <meta name="viewpo ...

随机推荐

  1. angular2 的依赖注入

    angular2 的依赖注入包含了太多的内容,其中的一个重点就是注入器,而注入器又非常难理解,今天我们不深入介绍注入器的内容,可以参考官方文档,我们今天来说注入器的层级. 也就是组件获取服务的容器会选 ...

  2. Form_通过Zoom客制化跳转页面功能(案例)

    2012-09-08 Created By BaoXinjian

  3. POJ 2318 TOYS(计算几何)

    题目大意:有一个矩形盒子,盒子里会有一些木块线段,并且这些线段是按照顺序给出的,有n条线段,把盒子分层了n+1个区域,然后有m个玩具,这m个玩具的坐标是已知的,问最后每个区域有多少个玩具 解题思路:因 ...

  4. 安装Android SDK和ADT步骤和遇到的问题

    http://894503895.diandian.com/post/2012-05-16/18695648 1.安装eclipse.下载地址:http://www.eclipse.org/downl ...

  5. JAVA break终止循环,与continue进入下一次循环

    一.break终止循环 在循环中,遇到break;将会跳出循环,继续往下执行代码 public class Test{ public static void main(String[] args){ ...

  6. android之AutoCompleteTextView控件用法

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools=&q ...

  7. StateMachine

    Create State Machine Create either a passive or an active state machine: ? 1 var fsm = new PassiveSt ...

  8. win10安装软件被阻止后

    以管理员身份运行CMD,然后在cmd里执行就可以了.

  9. RDLC添加页码

    页脚显示页码并总页数首先添加页脚,在页脚拖一textbox,textbox的表达式输入:="第" & Globals!PageNumber & "页 共& ...

  10. Angularjs路由.让人激动的技术.真给前端长脸了.

    先看文件的摆放 不废话,直接上代码. detail.html: <hr/> <h3>路由 <span style="color: red;">{ ...