Iphone annotationView中的不同详图索引

Iphone annotationView中的不同详图索引,iphone,xcode,map,annotations,Iphone,Xcode,Map,Annotations,我正在处理Map iOS6,遇到了一些问题: 如下图所示,当前位置和placeMark的注释也有标注按钮,但我需要按钮执行不同的任务,我如何才能做到这一点?这意味着在当前位置,我需要调用按钮来执行此任务,在placeMark中,调用按钮可以执行其他任务。 请访问此页面查看图像 我没有足够的声誉在这里发布图片。 我尝试了以下代码: - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view callou

我正在处理Map iOS6,遇到了一些问题: 如下图所示,当前位置和placeMark的注释也有标注按钮,但我需要按钮执行不同的任务,我如何才能做到这一点?这意味着在当前位置,我需要调用按钮来执行此任务,在placeMark中,调用按钮可以执行其他任务。
请访问此页面查看图像

我没有足够的声誉在这里发布图片。
我尝试了以下代码:

- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view
calloutAccessoryControlTapped:(UIControl *)control
{
    if ([(UIButton*)control buttonType] == UIButtonTypeDetailDisclosure)
    {
       ...
       locationSheet.cancelButtonIndex = locationSheet.numberOfButtons - 1;
    }else if ([(UIButton*)control buttonType] == UIButtonTypeInfoLight)
    {
       ...
       locationSheet.cancelButtonIndex = locationSheet.numberOfButtons - 1;
    }
}

如何在actionSheet中的两个按钮之间执行不同的任务?很难解释我的情况,我希望每个人都理解我在上面的表现,我感谢你的帮助。
感谢您的帮助。

我无法访问您的图像-但是如果您有实际的按钮(UIButton)而没有MKAnnotations,那么为什么不为您的按钮指定一个标记(当然每个按钮都有不同的标记),将它们指向相同的功能,然后根据标记进行区分?因此(这可以用于任何按钮,不仅仅是
uibuttonypecustom
,实际上也可以用于任何
UIView
——它们都支持
标记
):


我做到了。我忘记了“标签”功能。再次感谢贾伊·戈文达尼,这是我们中最好的!如果答案对你有帮助,请接受。干杯
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex {
    // 1
    if (buttonIndex != actionSheet.cancelButtonIndex)
    {
        if (buttonIndex == 0)
        {
        }
    }
}
 UIButton *firstButton = [UIButton buttonWithType:UIButtonTypeCustom];
 UIButton *secondButton = [UIButton buttonWithType:UIButtonTypeCustom];

 firstButton.tag = 100;
 secondButton.tag = 200;

 [firstButton addTarget:self selector:@selector(doSomething:)];
 [secondButton addTarget:self selector:@selector(doSomething:)];

 - (void)doSomething:(id)sender {
 UIButton *pressedButton = (UIButton*)sender;

 if (pressedButton.tag == 100) {
 //First button
 }
 else if (pressedButton.tag == 200) {
 //Second button
 }