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注解是附加在代码中的一些元信息,用于一些工具在编译.运行时进行解析和使用,起到说明.配置的功能.注解不会也不能影响代码的实际逻辑,仅仅起到辅助性的作用 下面我们来详细说说这个注解,到底是怎么一 ...
随机推荐
- 使用bufferevent进行libevent服务端和客户端的开发
参考了网上的一些例子,实验了基于bufferevent的开发. 首先是服务端: #include <netinet/in.h> #include <sys/socket.h> ...
- white-space: nowrap
CSS:需要加上宽度(width:100px).超出隐藏(overflow:hidden;).强制在同一行显示(white-space: nowrap;).省略号(text-overflow:elli ...
- 【服务器环境搭建-Centos】Nginx1.9.9 配置启用 --待续
1.worker_processes worker_processes 4;## 4核,所以设置4个 worker_cpu_affinity 0001 0010 0100 1000; nginx在启动 ...
- hdu5785(极角排序求所有锐角钝角个数)
做法很显然,求出所有的锐角和钝角就能求出有多少个锐角三角形了. 我用了愚钝的方法,写了两三个小时... 看了下别人简单的代码.学习了下做法. sort(temp+,temp+cnt+);//排序 Fo ...
- Css3_浏览器支持
#box{ color:red; ⁄* 所有浏览器都支持 *⁄ color:red !important; ⁄* Firefox.IE7支持 *⁄ _color:re ...
- sccm部署win7原版系统系统盘为D盘
1. 系统部署完毕之后是这样的
- assert的用处
ASSERT函数是用于调试中,也就是说在你的代码中当是Debug的时候它完成对参数的判断,如果是TRUE则什么都不做,如果是FALSE则弹出一个程序中断对话框提示程序出现错误.在Release版本中它 ...
- dede如何新建一个ajax服务端输出文件
<?phprequire_once(dirname(__FILE__)."/include/common.inc.php");AjaxHead(); $dsql-> ...
- 索引器(C# 编程指南)
原文地址:https://msdn.microsoft.com/zh-cn/library/6x16t2tx(VS.80).aspx 索引器允许类或结构的实例按照与数组相同的方式进行索引.索引器类似于 ...
- HTML5自学笔记[ 13 ]canvas绘图小实例之方块移动
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...