Last active
August 29, 2015 14:20
-
-
Save zkkmin/cfa6f4589cd52ad05028 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func showSelectedSearchPlace(selectedPlace :Place){ | |
// to close suggested list when the user selected one | |
searchController.active = false | |
searchController.searchBar.text = selectedPlace.placeName | |
// a red color symbol to mark the place | |
let myMarkerSymbol = AGSSimpleMarkerSymbol() | |
myMarkerSymbol.color = UIColor.redColor() | |
// a point representing x,y data from selctedPlace | |
let point = AGSPoint(x: selectedPlace.X, y: selectedPlace.Y, spatialReference: mapView.spatialReference) | |
// make the selectedPlace at the center of the map | |
mapView.centerAtPoint(point, animated: false) | |
// make a graphic with symbol and point to add to the map | |
var pointGraphic = AGSGraphic(geometry: point, symbol: myMarkerSymbol, attributes: nil) | |
// remove previously searched places | |
graphicLayer.removeAllGraphics() | |
// display the graphic on the map | |
graphicLayer.addGraphic(pointGraphic) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment