0
Ich habe 2 Pins in mapkit, beide sind unter der gleichen Anmerkungsansicht, so dass es seit dem, dass beide Pins die gleiche Farbe sind. Wie kann ich die Stifte verschiedene Farben machen? Ich möchte, dass Hallo rot und Hellox blau ist.wie Pin-Farbe in Mapkit unter der gleichen Annotationview ändern (swift3)
import UIKit
import MapKit
class ViewController: UIViewController, MKMapViewDelegate {
@IBOutlet var jmap: MKMapView!
override func viewDidLoad() {
jmap.delegate = self;
let hello = MKPointAnnotation()
hello.coordinate = CLLocationCoordinate2D(latitude: 40, longitude: -73)
jmap.addAnnotation(hello)
let hellox = MKPointAnnotation()
hellox.coordinate = CLLocationCoordinate2D(latitude: 34, longitude: -72)
jmap.addAnnotation(hellox)
}
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
let annotationView = MKPinAnnotationView()
annotationView.pinTintColor = .blue
return annotationView
}}