我已經爲用戶當前位置加載了自定義註釋圖像。我在後臺每隔1秒後更新當前用戶位置。平滑移動地圖上的註釋圖像
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[self performSelectorOnMainThread:@selector(tempupdate) withObject:nil waitUntilDone:NO];
[pool release];
-(void)tempupdate
{
NSLog(@"callToLocationManager");
mylocationManager = [[CLLocationManager alloc]init];
NSLog(@"locationManagerM = %@",mylocationManager);
mylocationManager.delegate = self;
mylocationManager.desiredAccuracy = kCLLocationAccuracyBest;
mylocationManager.distanceFilter = 500;
[mylocationManager startUpdatingLocation];
}
更新當前latutude和經度我正在使用清爽下面的代碼
MKCoordinateRegion region;
MKCoordinateSpan span;
span.latitudeDelta=0.002;
span.longitudeDelta=0.002;
CLLocationCoordinate2D location;
location.latitude=[lat doubleValue];
location.longitude=[longt doubleValue];
region.span=span;
region.center=location;
addAnnotation=[[AddressAnnotation alloc]initWithCoordinate:location];
[email protected]"You are here";
[self.mapView removeAnnotations:self.mapView.annotations];
[self.mapView addAnnotation:addAnnotation];
[self.mapView setRegion:region animated:TRUE];
[self.mapView regionThatFits:region];
但增加了map.How避免這種閃爍效果之前每一次的定製標註圖像閃爍的地圖後?
我知道問題在於刪除和添加地圖視圖的註解,但沒有任何其他辦法可以做到這一點?你能告訴我在細節我應該怎麼辦? – 2012-03-19 06:43:51
編輯我的答案示例代碼 – MobileVet 2012-03-21 17:42:18
嘿謝謝你的答覆,但它的不工作仍然給我跳躍效果。 – 2012-03-27 11:48:14