首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Iphone >

关于MKMapView 显示自己位置的有关问题

2013-02-25 
关于MKMapView 显示自己位置的问题- (void)locationManager:(CLLocationManager *)manager didUpdateToLoc

关于MKMapView 显示自己位置的问题


- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{  
    MKCoordinateSpan theSpan;
    //地图的范围 越小越精确
    theSpan.latitudeDelta = 0.01;
    theSpan.longitudeDelta = 0.01;
    MKCoordinateRegion theRegion ;
    theRegion.center = newLocation.coordinate; 
    theRegion.span = theSpan;
    [self.mapView setRegion:theRegion animated:YES];
    
}


这样设置那个我的位置那个绿点每次都不是在地图正中间。求解。 

[解决办法]
看看有没有设置delegate
[解决办法]
同意一楼的,应该是委托设置的问题。
你设置了地图的委托是没错,你也是从地图上获取的经纬度。
但是,你检查是否更新经纬度的事件(didUpdateToLocation)是locationManager的,而不是MKMapView的,而locationManager的委托是否绑定在你这个类上了?
LZ该去检查一下,看看是否是我说的这个原因。

热点排行