您的位置:首页 > 移动开发 > IOS开发

iOS 百度地图 设置显示区域 中心点和范围

2016-04-02 16:15 441 查看
定位后移动到定位中心点

- (void)didUpdateBMKUserLocation:(BMKUserLocation *)userLocation
{
NSLog(@"didUpdateUserLocation lat %f,long %f",userLocation.location.coordinate.latitude,userLocation.location.coordinate.longitude);
NSLog(@"定位成功!!!");
[myMap updateLocationData:userLocation];//更新位置 前提是MapView.showsUserLocation=YES;
myMap.centerCoordinate = userLocation.location.coordinate;//移动到中心点
}


在开发百度地图的时候会有这样的需求,需要设置地图显示在某个地方,虽然问题比较小,还是来记录一下。

并带有移动效果。

解决方案:

BMKCoordinateRegion region ;//表示范围的结构体
region.center = coordinate;//中心点
region.span.latitudeDelta = 0.1;//经度范围(设置为0.1表示显示范围为0.2的纬度范围)
region.span.longitudeDelta = 0.1;//纬度范围
[_mapView setRegion:region animated:YES];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: