![](/img/trans.png)
[英]iOS Mapbox SDK - How to add MGLPointAnnotation markers into a map layer
[英]MapBox iOS SDK: add map event
我正在尝试使用最新的MapBox iOS idk(3.2)设置iOS应用。 我在互联网上寻求了多少东西,找不到如何向mapview添加地图事件的示例。
例如:我想在地图空闲时添加一个事件。 有什么建议么?
UPDATE
我认为这是实现的正确方法:
func mapView(mapView: MGLMapView, regionDidChangeAnimated animated: Bool) {
}
如果您询问如何使用委托方法,请按以下步骤操作:
import Mapbox
// Declare conformance to the MGLMapViewDelegate protocol
class ViewController: UIViewController, MGLMapViewDelegate {
var mapView: MGLMapView!
override func viewDidLoad() {
super.viewDidLoad()
mapView = MGLMapView(frame: view.bounds)
mapView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
view.addSubview(mapView)
// Set the delegate property of our map view to self after instantiating it.
mapView.delegate = self
}
func mapView(mapView: MGLMapView, regionDidChangeAnimated animated: Bool) -> Bool {
// look at mapView properties and do something
}
}
有关如何使用Mapbox iOS SDK实施基本功能的示例,请参见https://www.mapbox.com/ios-sdk/examples/ 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.