0

追加された注釈を newlocation に移動したいのですが、以下はコードであり、それ以外の部分ではそれを行いたいです:

以前のコードでは、新しい注釈が追加され、以前の注釈が削除されましたが、方向の程度に影響を受けます。だから、新しい注釈を追加せずに注釈を移動したい。

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
    if (newLocation.horizontalAccuracy < 0)
        return;
    if  (!newLocation)
        return;

    static BOOL annotationAdded = NO;

    self.currentLocation = newLocation;
    self.previousLocation = oldLocation;

    if(self.currentLocation != nil)
    {
        CLLocationCoordinate2D location = CLLocationCoordinate2DMake(self.currentLocation.coordinate.latitude, self.currentLocation.coordinate.longitude);
        myAnnotation = [[MyAnnotation alloc] initWithCoordinates:location title:@"Current Location" subTitle:nil];
        if (!annotationAdded)
        {
            annotationAdded = YES;
            [self.myMapView addAnnotation:myAnnotation];
        }
        else
        {
            // Here i want to move added annotation to newlocation coordinates 

        }

    }
}
4

1 に答える 1