Created
February 15, 2017 22:13
-
-
Save DonMag/80c7c68229ef0c190ee02579e485f23e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| //---------------------------------------------------------------------------------- | |
| // new class | |
| // MyMKPointAnnotation.swift | |
| // ChatMap | |
| // | |
| // Created by Don Mag on 2/15/17. | |
| // Copyright © 2017 Chris. All rights reserved. | |
| // | |
| import Foundation | |
| import MapKit | |
| class MyMKPointAnnotation: MKPointAnnotation { | |
| public var myTag: Int = 0 | |
| } | |
| //---------------------------------------------------------------------------------- | |
| // in ViewController.swift | |
| // in func updateUI() | |
| // change | |
| // let annotation = MKPointAnnotation() | |
| // to | |
| let annotation = MyMKPointAnnotation() | |
| annotation.myTag = i | |
| // in func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? { | |
| // change | |
| // var annotationView = MKPinAnnotationView() | |
| // annotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: "\(value)") | |
| // to | |
| let myAnnot = annotation as! MyMKPointAnnotation | |
| let annotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: "\(myAnnot.myTag)") | |
| // see if that helps... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment