2012-04-22 4 views
1

私は、スタンドアローンの注釈ピンを座標に配置し、自動的にタイトル/サブタイトルでバブルを表示します。移動中の座標をトラッキングするとき、毎回ピンはアニメーションをドロップします。私はannView.animatesDrop=FALSEにしようとしましたが、この場合バブルは自動的に表示されません(私はselectAnnotation:addAnnotation animated:YESを使用して自動外観)。自動タイトル/字幕付きのピンをドロップアニメーションなしで表示するには何が必要ですか?マップアノテーションピンのバブルをドロップアニメーションなしで自動的に表示する方法

P.S.私の悪い英語を申し訳ありません。

+1

を試してみましたている:addAnnotationアニメーション:NO'? – tipycalFlow

+1

ありがとう、それは本当に動作します。私は説明が正しく翻訳されていないようです。 – user1349248

答えて

0

annView.animatesDrop = NO;

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

+0

はい、動作しますが、この場合はタイトル/字幕が自動的に表示されません。ご注意いただきありがとうございます。 – user1349248

0

annView.animatesDrop = FALSEを使用する必要がありますが、適切な場所に配置してください。そのannotationViewを作成した直後には、

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

delegateメソッドになります。

覚えていれば、追加した同じ実行ループでannotationViewを選択することはできません。新しい実行ループで発生させるには、遅延を0に設定して、

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

を使用します。私の場合は

、私はあなたは `selectAnnotationを

[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 
} 
+0

このケースでは、0遅延ドロップアニメーションが動作する時間がないため、正しく理解できますか? – user1349248

+0

いいえ、その選択は、外観と同じ実行ループでは発生しません。アニメーションでは、注釈ビューが適切な場所に来るまで選択が延期されました(したがって、後の実行ループにあります) –

関連する問題