相关疑难解决方法(0)

MapKit iOS 9 detailCalloutAccessoryView用法

在观看WWDC视频206后,我认为将详细的标注视图添加到mapView注释视图是一项微不足道的任务.

所以,我认为我做错了什么.

设置了引脚视图

func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {

    let view:MKAnnotationView!

    if let dequed = routeMapView.dequeueReusableAnnotationViewWithIdentifier("pin") {
        view = dequed
    }
    else {
        view = MKPinAnnotationView(annotation: annotation, reuseIdentifier: "pin")
    }

    let x = UIView(frame: CGRectMake(0, 0, 200, 200))
    x.backgroundColor = UIColor.redColor()

    // shows the red
    //view.leftCalloutAccessoryView = x

    // working as no subtitle - but no red view
    view.detailCalloutAccessoryView = x

    view.canShowCallout = true
    return view
}
Run Code Online (Sandbox Code Playgroud)

我只能得到这个

在此输入图像描述

我知道这个观点正在发挥作用,因为如果我试着用它leftCalloutAccessoryView来做 在此输入图像描述

我肯定错过了什么.请注意,如果我只是添加图像detailCalloutAccessoryView

view.detailCalloutAccessoryView …
Run Code Online (Sandbox Code Playgroud)

mapkit mkannotationview ios

18
推荐指数
2
解决办法
9238
查看次数

标签 统计

ios ×1

mapkit ×1

mkannotationview ×1