Zooming MKMapView to fit annotation pins
http://stackoverflow.com/questions/4680649/zooming-mkmapview-to-fit-annotation-pins
- (MKCoordinateRegion)regionFromLocations {
CLLocationCoordinate2D upper = [[locationFake objectAtIndex:0] coordinate];
CLLocationCoordinate2D lower = [[locationFake objectAtIndex:0] coordinate];
// FIND LIMITS
for(FGLocation *eachLocation in locationFake) {
if([eachLocation coordinate].latitude > upper.latitude) upper.latitude = [eachLocation coordinate].latitude;
if([eachLocation coordinate].latitude < lower.latitude) lower.latitude = [eachLocation coordinate].latitude;
if([eachLocation coordinate].longitude > upper.longitude) upper.longitude = [eachLocation coordinate].longitude;
if([eachLocation coordinate].longitude < lower.longitude) lower.longitude = [eachLocation coordinate].longitude;
}
// FIND REGION
MKCoordinateSpan locationSpan;
locationSpan.latitudeDelta = upper.latitude - lower.latitude;
locationSpan.longitudeDelta = upper.longitude - lower.longitude;
CLLocationCoordinate2D locationCenter;
locationCenter.latitude = (upper.latitude + lower.latitude) / 2;
locationCenter.longitude = (upper.longitude + lower.longitude) / 2;
MKCoordinateRegion region = MKCoordinateRegionMake(locationCenter, locationSpan);
return region;
}
Zooming MKMapView to fit annotation pins的更多相关文章
- RFIDler - An open source Software Defined RFID Reader/Writer/Emulator
https://www.kickstarter.com/projects/1708444109/rfidler-a-software-defined-rfid-reader-writer-emul h ...
- MKMapView缩放显示全部annotation(转)
原文 http://blog.csdn.net/favormm/article/details/8028026#define MINIMUM_ZOOM_ARC 0.014 //approximate ...
- iOS - MKMapView 地图
1.创建 MKMapView 地图 在 iOS6 或者 iOS7 中实现这个功能只需要添加地图控件.设置用户跟踪模式.在 mapView:didUpdateUserLocation: 代理方法中设置地 ...
- MKMapView的使用
#import "ViewController.h" #import "BVAnnotation.h" @interface ViewController () ...
- MKMapView and Zoom Levels: A Visual Guide
原帖:http://troybrant.net/blog/2010/01/mkmapview-and-zoom-levels-a-visual-guide/ So, how exactly does ...
- Jackson Annotation Examples
1. Overview In this article, we’ll do a deep dive into Jackson Annotations. We’ll see how to use the ...
- [Swift通天遁地]一、超级工具-(9)在地图视图MKMapView中添加支持交互动作的标注图标
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...
- Spring Enable annotation – writing a custom Enable annotation
原文地址:https://www.javacodegeeks.com/2015/04/spring-enable-annotation-writing-a-custom-enable-annotati ...
- 【java】细说 JAVA中 标注 注解(annotation)
Java注解是附加在代码中的一些元信息,用于一些工具在编译.运行时进行解析和使用,起到说明.配置的功能.注解不会也不能影响代码的实际逻辑,仅仅起到辅助性的作用 下面我们来详细说说这个注解,到底是怎么一 ...
随机推荐
- linux中脚本的一些小知识的积累
对于变量的问题: 对变量赋值,a="hello world",现在打印变量a的内容:echo $a. 对于${}的使用:如$aall,我们想要$a,这是,就可以${a}all了. ...
- Mac 实用工具与问题解决
1.在dock上方的一长溜,被我拖成个方块了 删掉里面的字符,然后按esc 即可! 2.FIT输入法(Fun Input Toy),是苹果操作系统OS X上的免费中文输入法,支持全拼/双拼/全双混拼, ...
- swift语言学习之UITableView分割线左边到头的解决
此方法兼容ios 7.8.9 // 在tableView创建地方设置 if tableView!.respondsToSelector("setSeparatorInset:") ...
- 如何让JS的变量名变量化
unction message() { var k=0; // var olk+k="sdasdasd"; eval("var olk"+k+"='a ...
- 项目中的五级地址联动效果(js)
我刚开始是的时候是是写了一个sql语句,但是写了5个函数,来联动地址的.后来请教了前段的师傅,用js来写了一个地址联动的. 我使用的是easyui的框架! 地址联动部分html代码! <tr&g ...
- virtualbox虚拟机上安装centOS的网络配置(安装centos时选择桥接网络)
最近接触hadoop,需要在在Linux上面开发,所以我装了一个virtualbox虚拟机,在该虚拟机上面安装了一个centOS系统.linux系统是装好了,但是网络配置却另人头疼.我主要是想让宿主机 ...
- VC++多工程项目
目录 第1章 VC++6.0 1 1.1 设置依赖关系 1 1.2 编译顺序 2 1.3 自动连接 3 1.4 静态库 3 1.4.1 嵌入 3 1.4.2 替换 ...
- 再说TCP神奇的40ms
版权声明:本文由安斌原创文章,转载请注明出处: 文章原文链接:https://www.qcloud.com/community/article/186 来源:腾云阁 https://www.qclou ...
- VirtualBox相关问题总结
欢迎关注我的社交账号: 邮箱: jiangxinnju@163.com 博客园地址: http://www.cnblogs.com/jiangxinnju GitHub地址: https://gith ...
- JAVA String作业——动手动脑以及课后实验性问题
一:如何解释这样的输出结果?从中你能总结出什么?1.源码 //mao2015.10.20 //==的两个分辨 //对原始数据而言 //对引用类型变量 public class StringPool { ...