我想将正确的访问器图像(交叉图像)添加到右上角,如下图所示,但我无法获取它的代码:我正在使用以下代码,但它没有给我我需要的东西.我需要下图所示位置的十字按钮。
annView.leftCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeContactAdd];
UIImage *listImage = [UIImage imageNamed:@"Close_normal.png"];
UIButton *listButton = [UIButton buttonWithType:UIButtonTypeCustom];
// get the image size and apply it to the button frame
// listButton.frame = CGRectMake(0,0,56,68);
CGRect listButtonFrame = listButton.frame;
listButtonFrame.size = listImage.size;
listButton.frame = listButtonFrame;
[listButton setImage:listImage forState:UIControlStateNormal];
annView.rightCalloutAccessoryView = listButton;
然后我还要做的是,当我单击十字按钮时,它应该关闭信息弹出窗口并删除注释
- (void) mapView:(MKMapView *)mv annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
if( // left accessor is clicked then execute this code) // what should i write here
{
SiteAnnotation *site = (SiteAnnotation *)view.annotation;
if(site.category == -1) {
if(addressAnnotation) {
[mapView removeAnnotation:addressAnnotation];
AddViewController *vc = [[[AddViewController alloc] initWithCoordinate:addressAnnotation.coordinate] autorelease];
[self.delegate pushViewController:vc animated:YES];
}
}
else {
[self showSiteDetails:site.identifier];
}
}
else if (// if right accessor cross image is clicked)
{
// Then here the code to dismiss the pop up and annotation pin on map
}
}