2012-03-05 73 views
0

我的鄉親,TO上標註點擊

我有一個用戶可以在任意位置單擊,那裏應該顯示一個標註,當我們點擊的標註應該導航到其他網頁的要求時,導航到其他頁面。 如果你選擇了一些位置,比如新德里或者其他一些街道,那麼它應該在選擇區域顯示一個標註,並且在標註這個標註時它應該導航到其他頁面。

+1

嘗試正確解釋問題,然後您可以得到您的答案。 – Kamarshad 2012-03-05 05:18:33

回答

0

如果你想標註的點擊,請在叫喚(rightCalloutAccessoryView)

使用此代碼在MkMApViewDelegete使用的UIButton

- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(Annotation *) annotation { 

    if(annotation == map.userLocation) return nil; 

    static NSString* AnnotationIdentifier = @"AnnotationIdentifier"; 


    MKPinAnnotationView* customPinView = [[[MKPinAnnotationView alloc] 
                                           initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier] autorelease]; 
    customPinView.pinColor = MKPinAnnotationColorRed; 
    customPinView.animatesDrop = YES; 
    customPinView.canShowCallout = YES; 

    UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; 
    [rightButton addTarget:self 
                                    action:@selector(showDetails) 
                forControlEvents:UIControlEventTouchUpInside]; 
    customPinView.rightCalloutAccessoryView = rightButton; 

    
    return customPinView; 


} 


-(void)showDetails 
{ 
// go to detail page code ...use pushController 
} 

,如果您有任何問題 請download代碼(蘋果)

+0

它不工作...請給我總代碼,因爲我是新的iPhone我不能得到這個。 – one 2012-03-05 05:35:59

+0

看到我的編輯答案 – Deepesh 2012-03-05 05:39:42

+0

有沒有你問題 – Deepesh 2012-03-05 05:49:08