1

私は標準の注釈ピンを座標に配置し、タイトル/サブタイトルで自動的にバブルを表示しています。移動中に座標を追跡すると、ピンが毎回アニメーションをドロップします。しようとしましannView.animatesDrop=FALSEたが、この場合、バブルは自動的に表示されません(自動表示のために を使用しselectAnnotation:addAnnotation animated:YESました)。ドロップ アニメーションなしで自動的にタイトル/サブタイトルが表示されるピンを設定するには、どうすればよいですか?

PS 下手な英語で申し訳ありません。

4

2 に答える 2

0

annView.animatesDrop = NO;

それは私のコードで動作します。ドロップアニメーションなしでピンを表示します。

于 2012-04-22T09:06:20.903 に答える
0

annView.animatesDrop=FALSE を使用する必要がありますが、適切な場所で使用してください。それは

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

そのannotationViewを作成した直後のデリゲートメソッド。

よく覚えていれば、追加した同じ実行ループでannotationViewを選択することはできません。私は

- (void)performSelector:(SEL)aSelector withObject:(id)anArgument afterDelay:(NSTimeInterval)delay

それを行うには、遅延を 0 に設定して、新しい実行ループで発生させます。

私の場合、私は持っています

[self performSelector:@selector(selectPlace:) withObject:annotation afterDelay:0];


- (void)selectPlace:(id)<MKAnnotation>place{
//Lots of stuff for my precise case
    CLLocationCoordinate2D center;
    center.latitude = place.latitudeValue;
    center.longitude = place.longitudeValue;
    MKCoordinateSpan span;
    span.latitudeDelta = 4;
    span.longitudeDelta = 5;
    MKCoordinateRegion germany;
    germany.center = center;
    germany.span = span;
    [mapView setRegion:germany animated:YES];
// End of custom stuff

    [mapView selectAnnotation:(id)place animated:YES];  //This is what you're interested in
}
于 2012-04-22T10:06:49.787 に答える