2012-04-22 36 views
1

我有一個標註註釋引腳,放置在我的座標上,自動顯示帶有標題/副標題的氣泡。當在移動中跟蹤我的座標時,每次都會放下動畫。我試圖annView.animatesDrop=FALSE,但在這種情況下,氣泡不會自動出現(對於自動外觀,我使用selectAnnotation:addAnnotation animated:YES)。需要做什麼才能讓自動標題/副標題顯示不帶動畫的動畫?如何自動在地圖註釋引腳上顯示氣泡而不會拖放動畫

P.S.對不起,我的英語不好。

+1

你嘗試'selectAnnotation:addAnnotation動畫:NO'? – tipycalFlow 2012-04-22 09:08:03

+1

謝謝,它確實有效。似乎我翻譯不正確的描述。 – user1349248 2012-04-22 19:13:29

回答

0

annView.animatesDrop = NO;

它在我的代碼中工作。顯示不帶下拉動畫的引腳。

+0

是的,它可以工作,但在這種情況下,標題/副標題不會自動顯示。感謝您的關注。 – user1349248 2012-04-22 19:20:56

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

我是否理解正確,在這種情況下,由於0延時下降動畫只是沒有時間操作? – user1349248 2012-04-22 19:51:04

+0

不,這是選擇不能出現在與外觀相同的運行循環中。通過動畫,選擇被延遲直到註解視圖位於正確的位置(因此它在稍後的運行循環中) – 2012-04-23 06:06:12

相關問題