是否可以为 SKCalloutView 使用自定义视图?

Is it possible to use custom view for SKCalloutView?

是否可以使用 Label 和 Button 等元素制作自定义 UIView,并将其用作 CalloutView?

到目前为止,我通过文档阅读的内容并未暗示这是可能的。

可以更改左右按钮,以及为箭头添加自定义 UIImageView,但无法确定是否真的可以自定义整个视图。

是的 - 您只需覆盖 calloutViewForAnnotation 回调。演示项目中有一个示例(参见 AnnotationsViewController.m 内部),您可以在其中创建用户定义的 UIView 和 return that

- (UIView*)mapView:(SKMapView *)mapView calloutViewForAnnotation:(SKAnnotation *)annotation
{
    //Custom callouts.
    if (annotation.identifier == self.annotation1.identifier)
    {
        UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0.0f, 0.0f, 200.0f, 50.0f)];
        view.backgroundColor = [UIColor purpleColor];
        view.alpha = 0.5f;
        return view;
    }

    return nil;// Default callout view will be used.
}