1

私は Mapkit を使用しており、SDK 4.2 を使用しています。ここで奇妙なバグが発生しています。実際には、「blue.png」、red.png、black.png の 3 つの注釈タイプがあります。これらをフラックスでロードしています。タイプに応じて、これらの注釈タイプが選択されます。マップが読み込まれると、すべてが正常に機能します。別の注釈ビューがありますが、移動、ズームイン、またはズームアウトすると、注釈ビューが変更されます。つまり、blue.png になるはずだった場所が black.png になります。

私は実際にデバイスでそれをテストしています。

どうもありがとうございました :)

4

2 に答える 2

0

私は解決策を見つけました-実際、私はカスタム注釈ビューを使用しており、3つの差分タイプの画像を持っています:

ソルン:

- (AnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{

    AnnotationView *annotationView = nil;

    // determine the type of annotation, and produce the correct type of annotation view for it.
    AnnotationDetails* myAnnotation = (AnnotationDetails *)annotation;

    if(myAnnotation.annotationType == AnnotationTypeGeo)
    {
// annotation for your current position
        NSString* identifier = @"geo";
        AnnotationView *newAnnotationView = (AnnotationView *)[self.mapView dequeueReusableAnnotationViewWithIdentifier:identifier];

        if(nil == newAnnotationView)
        {
            newAnnotationView = [[[AnnotationView alloc] initWithAnnotation:myAnnotation reuseIdentifier:identifier] autorelease];
        }

        annotationView = newAnnotationView;
    }
    else if(myAnnotation.annotationType == AnnotationTypeMyfriends)
    {
        NSString* identifier = @"friends";
AnnotationView *newAnnotationView = (AnnotationView *)[self.mapView dequeueReusableAnnotationViewWithIdentifier:identifier];

        if(nil == newAnnotationView)
        {
            newAnnotationView = [[[AnnotationView alloc] initWithAnnotation:myAnnotation reuseIdentifier:identifier] autorelease];
        }

        annotationView = newAnnotationView;
}
}
于 2011-02-28T23:49:16.370 に答える