ios - How to change a map annotation location by tapping and still be able to pan? (gif included) -
i have been able add annotation , change it's location, how change it's location tapping, , @ same time still able pan around in map? (please have @ gif, shows needed).
solved, hope people find useful
var map1 = mkmapview() var pointannotation:mkpointannotation = mkpointannotation() func handletap(gesturereconizer: uitapgesturerecognizer) { let location = gesturereconizer.locationinview(map1) let coordinate = map1.convertpoint(location,tocoordinatefromview: map1) pointannotation.coordinate = coordinate } override func viewdidappear(animated: bool) { map1 = self.scrollview.viewwithtag(801) as! mkmapview map1.showsuserlocation = true map1.tintcolor = uicolor.bluecolor() let initiallocation = cllocation(latitude: ram.currentlat, longitude: ram.currentlon ) self.centermaponlocation(initiallocation, map: map1, regionradius: 707) var coordinates : cllocationcoordinate2d = cllocationcoordinate2d(latitude: ram.currentlat, longitude: ram.currentlon) pointannotation.coordinate = coordinates map1.addannotation(pointannotation) let gesturerecognizer = uitapgesturerecognizer(target: self, action:"handletap:") gesturerecognizer.delegate = self map1.addgesturerecognizer(gesturerecognizer) }
Comments
Post a Comment