1

我已经在当前纬度和经度上创建了注释视图,并使用自定义注释在其上使用了图像。它工作正常,并使用 Apple 示例 MapCallout https://developer.apple.com/library/ios/samplecode/MapCallouts/Introduction/Intro.html [使用标志部分设置图像并从紫色引脚符号单击部分] 创建自定义标注] 但是我的点击在 iPhone 模拟器 5 及更高版本中工作正常,但点击在 iPhone 4S 模拟器中无法通过标注工作,我尝试了很多方法但没有成功。任何人都可以建议我错过为 iPhone 4s 设置什么来运行点击标注。

我的代码在视图注释中如下,

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
    MKAnnotationView *returnedAnnotationView = nil;

    if([annotation isKindOfClass:[MAKRSampleAnnotation class]])
    {
        returnedAnnotationView = [MAKRSampleAnnotation createViewAnnotationForMapView:self.mapView annotation:annotation];

        // provide the annotation view's image
        returnedAnnotationView.image = [UIImage imageNamed:@"map_pointer_yellow.png"];

        // trying to click using this in 4s , working in iPhone 5 and later
        UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        [rightButton addTarget:nil action:nil forControlEvents:UIControlEventTouchUpInside];
        ((MKPinAnnotationView *)returnedAnnotationView).rightCalloutAccessoryView = rightButton;

        return returnedAnnotationView;
    }

    return returnedAnnotationView;
}

我花了很多时间来解决这个问题,但没有运气来解决这个问题。

谢谢。

4

0 回答 0