IOS 百度地图获取当前屏幕的经纬度
2015-12-24 00:00
519 查看
//当前屏幕中心点的经纬度
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);
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开发系列--通讯录、蓝牙、内购、GameCenter、iCloud、Passbook系统服务开
- iOS捕获异常,常用的异常处理方法
- IOS compare 字符串比较
- iOS项目工程及目录结构
- iOS图文混排的简易实现
- Tableview 默认选中第一行以及选中背景自定义
- ios some tips
- iOS crash log 文件解析
- iOS调节系统音量
- iOS开发多线程----简单介绍篇
- 蓝懿 iOS 技术交流和心得分享 12.23
- iOS开发 带xib的自定义View自适应屏幕问题
- iOS开发之绘制文本内容
- iOS9 getting error “an ssl error has occurred and a secure connection to the server cannot be made”
- iOS之触摸事件和手势
- iOS9适配总结
- iOS通讯录开发
- [转] iOS --- 基于面向协议MVP模式下的软件设计
- iOS --- 使用CADisplayLink来实现定时任务
- (NO.00005)iOS实现炸弹人游戏(三):从主场景类谈起