저는 iOS 개발 및지도 박스에서 새롭기 때문에 질문이 어리석은 것 같아서 미안하지만 어디서나 답변을 찾을 수 없습니다. 지도와 주석이 있습니다. 사용자가 주석 (길게 누르는 제스처)을 터치하고 누르고있을 때 다른 정보를 보여주고 싶습니다. 나는 길게 누르기 제스처가 작동하지만, 손길이 닿은 주석을 찾거나 적어도 그것의 색인을 찾는 방법을 찾았습니다. 지금까지이 같은 그것을 가지고 :이Mapbox는 길게 누르는 동작 후에지도에서 주석을 찾습니다.
let pointAnotation = MGLPointAnnotation()
pointAnotation.coordinate = CLLocationCoordinate2DMake(event.lat, event.lng)
pointAnotation.title = name
pointAnotation.subtitle = headline
self.mapView.addAnnotation(pointAnotation)
같은 주석을 추가 해요
class eventsMapController: UIViewController, MGLMapViewDelegate {
override func viewDidLoad() {
super.viewDidLoad()
mapView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
// Set the map's bounds to Oslo 59.920269,10.71167
//let bounds = MGLCoordinateBounds(sw: CLLocationCoordinate2D(latitude: 59.925861, longitude: 10.712185),
// ne: CLLocationCoordinate2D(latitude: 59.889798, longitude: 10.794754))
view.addSubview(mapView)
// Set the map view‘s delegate property
mapView.delegate = self
let myGesture = UILongPressGestureRecognizer(target: self, action: #selector(eventsMapController.testLongGesture))
myGesture.minimumPressDuration = 0.8
mapView.addGestureRecognizer(myGesture)
}
func testLongGesture(long: UILongPressGestureRecognizer){
if long.state == .Began{
print("begin", long)
}
}
}
내가 그것을 알아 내려고 많은 시간을 사용, 누군가 저를 도와주세요.