2012-03-05 70 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