It looks like you’re reusing your lbl
and adding it to each annotation, hence you’re only seeing it in the last annotation. You will have to create new UILabel
for each annotation and add it as a subview the same way you’re doing with pinlbl
, as what you have now is removing lbl
from the previous annotation and re-adding it to the next one until it stops and persists it in the last annotation on the map.
Just change the following
annoIcon.image = UIImage(named: "cancel-red")
// create new label here
let lbl = UILabel()
// the rest of your code can stay the same
CLICK HERE to find out more related problems solutions.