它在Maps.app中以相同的方式工作:當您點擊並按住一兩秒鐘時,應用程序將在此處放置一個別針。如何在點擊並按住地圖時創建事件?
我會在這裏附上一段代碼(我需要LongPress來處理註釋,並且它在這段代碼中不起作用)。請考慮幫助。
MKPinAnnotationView* pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:MeAnnotationIdentifier] autorelease];
pinView.canShowCallout = NO;
UILongPressGestureRecognizer *longPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(showCountdown:)];
[pinView addGestureRecognizer:longPressGesture];
[longPressGesture release];
你是否開始編寫任何代碼,或者這只是一個想法? – 2011-04-04 13:11:07
@Dan Ray:出現了另一個問題,你可以看看問題主體中的代碼嗎?該事件不會觸發。 – buh 2011-04-05 15:11:57