zoukankan      html  css  js  c++  java
  • 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;
    }
  • 相关阅读:
    DevComponents DotNetBar 中Ribbon汉化
    类型Universe无法解析程序 集:System.Design,Version=2.0.0.0
    MapXtreme使用编辑工具
    html中汉字乱码
    c#皮肤使用
    c# 中的internal使用
    DonNetBar汉化
    外汇期货学习专帖(转)
    苦难属于悲情的人
    IT规划宜分步走 忌盲目好大喜功(载)
  • 原文地址:https://www.cnblogs.com/Keys/p/4521851.html
Copyright © 2011-2022 走看看