Hi community,
I have a problem with an array of MKAnnotationViews that are customized, in which I want to display the information for each marker individually, such as its title or its description that contains that marker, I don't know if it opens any way to do it.
I leave my code below:
func setUpAllThePins(allLogos:[String],allLongitudesAndLatitudes:[CLLocationCoordinate2D],kmDouble:[Double],streets:[String],alcaldia:[String],calificacion:[Int],titulos:[String]){
imagenes = allLogos.compactMap{ link->UIImage? in
guard let url = URL(string: link) else {return nil}
guard let imageData = try? Data(contentsOf: url) else {return nil}
return UIImage(data: imageData)
}
let annotations = zip(allLongitudesAndLatitudes, imagenes)
.map { (coordinate, allLogos) -> myAnnotation in
let annotation = myAnnotation(title: "", subtitle: "", coordinate: coordinate, localImage: allLogos)
return annotation
}
if let oldArray = annotations as? [MKAnnotation]{
for i in oldArray{
mapView.addAnnotation(i)
}
}
}
I have a problem with an array of MKAnnotationViews that are customized, in which I want to display the information for each marker individually, such as its title or its description that contains that marker, I don't know if it opens any way to do it.
I leave my code below:
func setUpAllThePins(allLogos:[String],allLongitudesAndLatitudes:[CLLocationCoordinate2D],kmDouble:[Double],streets:[String],alcaldia:[String],calificacion:[Int],titulos:[String]){
imagenes = allLogos.compactMap{ link->UIImage? in
guard let url = URL(string: link) else {return nil}
guard let imageData = try? Data(contentsOf: url) else {return nil}
return UIImage(data: imageData)
}
let annotations = zip(allLongitudesAndLatitudes, imagenes)
.map { (coordinate, allLogos) -> myAnnotation in
let annotation = myAnnotation(title: "", subtitle: "", coordinate: coordinate, localImage: allLogos)
return annotation
}
if let oldArray = annotations as? [MKAnnotation]{
for i in oldArray{
mapView.addAnnotation(i)
}
}
}