mkannotation

Set MapKit pins with different colors

六眼飞鱼酱① 提交于 2021-02-11 12:38:06
问题 I am new in iOS and I implemented a MapKit with static markers from different arrays types and they are working fine , I am trying to put pins that come from shops array to be blue for example , and pins that come from community read , etc .. I have no idea about how to do this at all , they are all in red in the map and my goal is to change the color for every array of pins here what I have tried : import UIKit import MapKit class myMapViewController: UIViewController, MKMapViewDelegate {

Force MKMapView viewForAnnotation to update

断了今生、忘了曾经 提交于 2021-02-06 15:18:33
问题 So I have a MKMapView with all my pins added, and the colour of the pin is dependent on whether a value is set for that pin. When I first load the app, viewForAnnotation is called and the colours are set accordingly. However, when I update the pin's details (such as location, title, etc...) I also update the pinColour to find it doesn't update. It looks like viewForAnnotation isn't called again after the initial add. I have read many questions similar to this and I can confirm that mapView

Force MKMapView viewForAnnotation to update

安稳与你 提交于 2021-02-06 15:17:59
问题 So I have a MKMapView with all my pins added, and the colour of the pin is dependent on whether a value is set for that pin. When I first load the app, viewForAnnotation is called and the colours are set accordingly. However, when I update the pin's details (such as location, title, etc...) I also update the pinColour to find it doesn't update. It looks like viewForAnnotation isn't called again after the initial add. I have read many questions similar to this and I can confirm that mapView

MapKit in Swift, Part 3 - MKPointAnnotation, addAnnotations

亡梦爱人 提交于 2021-01-28 21:34:32
问题 I'm trying work with Map Kit in Swift. I try to display the area on the map, some pins (MKPointAnnotation) and the current position. I decided to extend the class MKPointAnnotation - add a category. Class MyAnnotation.swift: import UIKit import MapKit class MyAnnotation: MKPointAnnotation { var category = Int() } I made an array of tuples to store information about the objects. In the loop I process all the elements of this array and make from it an array MyAnnotation . Then, I try to display