码迷,mamicode.com
首页 > 移动开发 > 详细

iOS-百度地图_屏幕所显示范围内的经纬度

时间:2015-07-08 18:10:37      阅读:1177      评论:0      收藏:0      [点我收藏+]

标签:

  //当前屏幕中心点的经纬度

    CGFloat centerLongitude = self.mapView.region.center.longitude;

    CGFloat centerLatitude = self.mapView.region.center.latitude;

    //当前屏幕显示范围的经纬度

    CLLocationDegrees pointssLongitudeDelta = self.mapView.region.span.longitudeDelta;

    CLLocationDegrees pointssLatitudeDelta = self.mapView.region.span.latitudeDelta;

   

    //左上角

    CGFloat leftUpLong = centerLongitude - pointssLongitudeDelta/2.0;

    CGFloat leftUpLati = centerLatitude - pointssLatitudeDelta/2.0;

    //右上角

    CGFloat rightUpLong = centerLongitude + pointssLongitudeDelta/2.0;

    CGFloat rightUpLati = centerLatitude - pointssLatitudeDelta/2.0;

    //左下角

    CGFloat leftDownLong = centerLongitude - pointssLongitudeDelta/2.0;

    CGFloat leftDownlati = centerLatitude + pointssLatitudeDelta/2.0;

    //右下角

    CGFloat rightDownLong = centerLongitude + pointssLongitudeDelta/2.0;

    CGFloat rightDownLati = centerLatitude + pointssLatitudeDelta/2.0;

   

    NSLog(@"\n 左上   %f,%f---------\n 右上   %f,%f-------\n 左下  %f,%f----- \n 右下  %f,%f",leftUpLong,leftUpLati,rightUpLong,rightUpLati,leftDownLong,leftDownlati,rightDownLong,rightDownLati);

iOS-百度地图_屏幕所显示范围内的经纬度

标签:

原文地址:http://www.cnblogs.com/dondre/p/4630677.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!