HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – 地图视图注释代表swift 3.0大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_772_2@
// MARK: - MapView Delegate
override func mapView(_ mapView: MKMapView,viewForAnnotation Annotation: MKAnnotation) -> MKAnnotationView? {

    var anView = mapView.dequeueReusableAnnotationView(withIdentifier: AnnotationReusEID)

    if anView == nil {
        anView = MKAnnotationView(Annotation: Annotation,reusEIDentifier: AnnotationReusEID)
    } else {
        anView!.Annotation = Annotation
    }
    anView!.image = UIImage(named: "Contactus_gatePin")
    anView?.frame = CGRect(x: 0,y: 0,width: 53,height: 53)
    anView!.BACkgroundColor = UIColor.clear
    anView!.canShowCallout = false
    return anView
}

override func mapView(_ mapView: MKMapView,didSELEct view: MKAnnotationView) {
    return
}

我在Swift3中遇到此方法错误.它在Swift2.2中工作
我无法将其转换为Swift 3.0
请帮忙

@H_772_2@

解决方法

在Swift 3中,MKMapViewDelegate的viewForAnnotation方法就像这样改变了.

optional func mapView(_ mapView: MKMapView,viewFor Annotation: MKAnnotation) -> MKAnnotationView? {

}

其他方法在MKMapViewDelegate上检查Apple Documentation.

@H_772_2@ @H_772_2@
@H_772_2@
@H_772_2@

大佬总结

以上是大佬教程为你收集整理的ios – 地图视图注释代表swift 3.0全部内容,希望文章能够帮你解决ios – 地图视图注释代表swift 3.0所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。