2011-03-22 136 views
0

我已经在注释视图中添加图像,当我接触注释查看其照片量变到质变为红脚任何一个可以告诉我什么是他的原因吧MapView的注释

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation 
{ 
    MKPinAnnotationView* newAnnotation = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"annotation1"]; 

    if (annotation == _mapView.userLocation) 
    { 
     newAnnotation.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; 
     return nil; 
    } 

    //[newAnnotation setSelected:YES]; 
    newAnnotation.image = [UIImage imageNamed:@"sample.png"]; 
    newAnnotation.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; 
    newAnnotation.canShowCallout = YES; 
    [newAnnotation retain]; 

    return newAnnotation; 

} 
+0

您是否在MKPinAnnotationView中添加图像。 ? – Jhaliya 2011-03-22 08:17:04

+0

如果你想一些答案,我建议您发布一些代码,一定会帮助你更好地 – visakh7 2011-03-22 08:22:05

+0

你做删除当u触摸注解视图 – Splendid 2011-03-22 09:27:41

回答

1

充分利用newAnnotation一个MKAnnotationView而比一个MKPinAnnotationView

+0

由于其现在的工作 – 2011-03-22 09:41:15

+0

我也想展示与叫出我该怎么办选定annotaion注解它 – 2011-03-22 09:41:58

+1

http://stackoverflow.com/questions/2193843/how-to-open-call-out-mkannotationview-programmatically-iphone-mapkit – Rog 2011-03-22 09:43:04