swift - 如何禁用 Mapkit 中的默认标注 View ?

标签 swift mapkit

我需要从 map 套件中禁用默认标注 View ,我正在使用自定义标注 View ,现在当我单击图钉图标时它会获取两个 View 。

 func mapView(mapView: MKMapView, didSelectAnnotationView view: MKAnnotationView){
    let customView = (NSBundle.mainBundle().loadNibNamed("CustomCalloutView", owner: self, options: nil))[0] as! CustomCalloutView;

    let button = UIButton(frame: CGRectMake(0, 0, 100, 50))
    button.addTarget(self, action: Selector("buttonPressed:"), forControlEvents: .TouchUpInside)

    button.userInteractionEnabled = true
    button.backgroundColor = UIColor.greenColor()

    customView.addSubview(button) // assuming you're in a view controller

    self.view.addSubview(customView)
}

最佳答案

终于找到解决方案了。

只需注释掉 MKAnnotation 对象自定义类中的“标题”和“描述”即可。

关于swift - 如何禁用 Mapkit 中的默认标注 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37314534/

相关文章:

ios - WatchKit 2.0 检测何时收到 APNS

Swift 协议(protocol)继承

ios - Swift/IOS 如何使用观察者进行更新

ios - 固定颜色未按预期正常显示

ios - 如何实现随 map 旋转的 MKAnnotationView

swift - 一个服务应该调用另一个服务还是应该获取它自己的数据

swift - SWRevealViewController 具有实用 View

ios - 缩小以显示用户位置/注释

ios - Google map 中的 didUpdateUserLocation?

ios - 更改市场中集群注释的颜色。 iOS, swift