私は現在のユーザーの場所のカスタム注釈画像を読み込んでいます。バックグラウンドで1秒ごとに現在のユーザーの場所を更新しています。私はこのちらつき効果を避けるために、map.Howに追加する前に、次のコードMapviewでの注釈画像のスムーズな移動
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];
しかしたびにカスタムアノテーション画像が点滅を使用してマップを更新しています現在latutudeと経度を更新した後
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];
}
?
私はあなたが私は何をすべき詳細に教えてくださいできますか?問題は、マップビュー上の注釈を削除し、追加することであるが、これを行うには、他の方法があると知っていますか? –
サンプルコード – MobileVet
で私の答えを編集しました。お返事ありがとうございます。 –