MKAnnotation image offset with custom pin image
</pre><pre>
Your UIAnnotationView is
always drawn at the same scale, the map's zoom level doesn't matter. That's why centerOffset isn't
bound with the zoom level.
annView.centerOffset is
what you need. If you see that your pin is not at the good location (for example, the bottom center move a little when you change the zoom level), it's because you didn't set the right centerOffset.
By the way, if you want to set the point of the coordinate at the bottom center of the image, the x coordinate of your centerOffset should be 0.0f, as annotationView center the image by default. So try :
annView.centerOffset = CGPointMake(0, -imageHeight / 2);
或是
Setting the centerOffset often moves the image arround when user rotates or zooms the map, as anchor point is still set to the center of the image instead of its lower center.
You can set the anchor point of the annotation to the bottom center of you custom image as follows:
yourAnnotation.layer.anchorPoint = CGPointMake(0.5f, 1.0f);
This way when user zooms or rotates the map your custom annotation will never move from its coordinates on the map.
http://stackoverflow.com/questions/8165262/mkannotation-image-offset-with-custom-pin-image
MKAnnotation image offset with custom pin image的更多相关文章
- Android系统匿名共享内存Ashmem(Anonymous Shared Memory)驱动程序源代码分析
文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/6664554 在上一文章Android系统匿名共 ...
- ORM数据库框架 greenDAO SQLite MD
Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...
- M451 PWM对照数据手册分析
PWM_T Struct Reference Control Register » Pulse Width Modulation Controller(PWM) typedef struct { ...
- 说说M451例程之PWM的寄存器讲解
M451提供了两路PWM发生器.每路PWM支持6通道PWM输出或输入捕捉.有一个12位的预分频器把时钟源分频后输入给16位的计数器,另外还有一个16位的比较器.PWM计数器支持向上,向下,上下计数方式 ...
- Bing必应地图中国API-画线与添加多边形
Bing必应地图中国API-画线与添加多边形 2011-05-24 14:31:20| 分类: Bing&Google|字号 订阅 在必应地图上画线的功能应用也很广泛:显示从出发地到 ...
- JTAG 引脚自动识别 JTAG Finder, JTAG Pinout Tool, JTAG Pin Finder, JTAG pinout detector, JTAGULATOR, Easy-JTAG, JTAG Enumeration
JTAG Finder Figuring out the JTAG Pinouts on a Device is usually the most time-consuming and frustra ...
- (转) Unreal Engine 4 Custom Shaders Tutorial
说明: 1.这里的Custom Shaders 为且仅为 Custom Node的使用和USF的包含.并非全局Shader和Material Shader. 2.原文来源:https://www.ra ...
- [UE4] Adding a custom shading model
转自:https://blog.felixkate.net/2016/05/22/adding-a-custom-shading-model-1/ This was written in Februa ...
- 一个美术需求引发的Custom Inspector
需求 Editor模式下,在运行或者非运行状态下,能够按照指定的变化率来自动改变material中属性数值. 需求分析 如何在Editor模式下获得一个游戏对象及其组件,尤其是在非运行状态下?我们知道 ...
随机推荐
- 尝试 javascript 一对多 双向绑定器
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8 ...
- SP338ROADS题解--最短路变式
题目链接 https://www.luogu.org/problemnew/show/SP338 分析 联想到不久前做过的一道题\(Full\) \(Tank\),感觉可以用优先队列做,于是写了\(d ...
- 对于div里面内容过大根据长度或者宽度进行适配,然后可以滚轮缩放的功能
在做3000的项目中,因为页面的svg很大,但是做的只是适配电脑,打开肯定是看不全的,要看全就必须进行滚动,可是客户提出了将页面放在电视机上面,用电视输入网址直接访问,这样问题就来了,电视上怎么进行滚 ...
- 8.JSP与JavaBean
1.<jsp:useBean> <html> <head> <title>jsp:useBean 标签的使用</title> </he ...
- Flutter——ListView组件(平铺列表组件)
ListView的常见参数: 名称 类型 说明 scrollDirection Axis Axis.horizontal 水平列表 Axis.vertical 垂直列表 padding EdgeIns ...
- 关于使用jquery评论插件...
.今天做项目,使用了一个评论插件 调用出来没事, 可是添加的时候报错 Uncaught TypeError: $(...).find(...).live is not a function 这个错误 ...
- 2.01_Python网络爬虫概述
一:什么是网络爬虫 网络爬虫(又被称为网页蜘蛛,网络机器人,在FOAF社区中间,更经常的称为网页追逐者),是一种按照一定的规则,自动地抓取网络信息的程序或者脚本: 二:为什么要做网络爬虫? 大数据时代 ...
- iTerm2快速SSH连接并保存密码
背景 Mac自带terminal,以及比较好用的iTerm2命令行工具,都缺乏一个功能,就是远程SSH连接,无法保存密码.一种方法是将本机的ssh_key放到远程服务器中实现无密码登录.这种方法在很多 ...
- 大数据量时Mysql的优化
(转自网络) 如今随着互联网的发展,数据的量级也是撑指数的增长,从GB到TB到PB.对数据的各种操作也是愈加的困难,传统的关系性数据库已经无法满足快速查询与插入数据的需求.这个时候NoSQL的出现暂时 ...
- Thinkphp3.2.3关于开启DEBUG正常,关闭DEBUG就报错模版无法找到,页面错误!请稍后再试~
这是Thinkphp3.2.3的一个坑- 具体原因也没搞清楚,测试环境都是好的,线上就出问题,是因为线上debug是关闭的 具体原委特此记录: 现象:(打开DEBUG就正常了,所以界面看不到具体报错滴 ...