mkpointannotation

MKPointAnnotations touch event in swift

早过忘川 提交于 2019-11-30 13:21:56
I would like to know if anyone can tell me how I can touch a pin on the map in the form of MKPointAnnotations . I would like to click the pin on the map and go to another view by bringing back the variables of the pin that I have preset . Can anyone explain me this thing in Swift ? thanks Edit with code: class ViewController: UIViewController, MKMapViewDelegate { @IBOutlet weak var mappa: MKMapView! override func viewDidLoad() { super.viewDidLoad() var location : CLLocationCoordinate2D = CLLocationCoordinate2D(latitude: 44.648590, longitude: 10.918794) let pinAnnotation = PinAnnotation()

XCode 6.3 MKPointAnnotation setCoordinate missing

♀尐吖头ヾ 提交于 2019-11-30 08:30:28
I just updated XCode to 6.3 and now I am receiving the below error: MKPointAnnotation does not have a member named 'setCoordinate'. Not sure where it went, or if we are supposed to use some other MK method. Any help is appreciated. func refreshlocation(lat:String, lon:String, withOffset:Bool = false){ // 1 Convert the string values to something that can be used. let location = CLLocationCoordinate2D( latitude: (lat as NSString).doubleValue as CLLocationDegrees, longitude: (lon as NSString).doubleValue as CLLocationDegrees ) // 2 setup some initial variables. let span = MKCoordinateSpanMake(

MKMapView MKPointAnnotation tap event not called

白昼怎懂夜的黑 提交于 2019-11-29 11:42:13
I am using a MKMapView (delegate is set correctly) with a MKPointAnnotation. The annotations are generated in this method called on a background thread. func updateMapAnnotations() { for var i = 0; i < DataManager.getStationList().count; i++ { var s = DataManager.getStationList()[i] as Station var annotation = MKPointAnnotation() annotation.setCoordinate(CLLocationCoordinate2D(latitude: s.latitude, longitude: s.longitude)) annotation.title = "\(s.id)" dispatch_async(dispatch_get_main_queue(), { self.mapView.addAnnotation(annotation) }) } } The annotationViews are generated in here: func

XCode 6.3 MKPointAnnotation setCoordinate missing

与世无争的帅哥 提交于 2019-11-29 11:23:40
问题 I just updated XCode to 6.3 and now I am receiving the below error: MKPointAnnotation does not have a member named 'setCoordinate'. Not sure where it went, or if we are supposed to use some other MK method. Any help is appreciated. func refreshlocation(lat:String, lon:String, withOffset:Bool = false){ // 1 Convert the string values to something that can be used. let location = CLLocationCoordinate2D( latitude: (lat as NSString).doubleValue as CLLocationDegrees, longitude: (lon as NSString)

MKMapView MKPointAnnotation tap event not called

谁说胖子不能爱 提交于 2019-11-28 05:16:12
问题 I am using a MKMapView (delegate is set correctly) with a MKPointAnnotation. The annotations are generated in this method called on a background thread. func updateMapAnnotations() { for var i = 0; i < DataManager.getStationList().count; i++ { var s = DataManager.getStationList()[i] as Station var annotation = MKPointAnnotation() annotation.setCoordinate(CLLocationCoordinate2D(latitude: s.latitude, longitude: s.longitude)) annotation.title = "\(s.id)" dispatch_async(dispatch_get_main_queue(),

Swift different images for Annotation

谁说胖子不能爱 提交于 2019-11-26 14:25:46
I managed to get a custom icon for a annotation pin in Swift, but now I am still stuck using 2 different images for different annotations. Right now a button adds a annotation to the map. There should be another button that also adds a annotation but with another icon. Is there a way to use the reuseId for this? class ViewController: UIViewController, MKMapViewDelegate { @IBOutlet weak var Map: MKMapView! @IBAction func btpressed(sender: AnyObject) { var lat:CLLocationDegrees = 40.748708 var long:CLLocationDegrees = -73.985643 var latDelta:CLLocationDegrees = 0.01 var longDelta

Swift different images for Annotation

五迷三道 提交于 2019-11-26 03:10:24
问题 I managed to get a custom icon for a annotation pin in Swift, but now I am still stuck using 2 different images for different annotations. Right now a button adds a annotation to the map. There should be another button that also adds a annotation but with another icon. Is there a way to use the reuseId for this? class ViewController: UIViewController, MKMapViewDelegate { @IBOutlet weak var Map: MKMapView! @IBAction func btpressed(sender: AnyObject) { var lat:CLLocationDegrees = 40.748708 var