ios - Image on annotation Swift -
trying use own image "pin" , have 4 different images. since i'm using alot of coords, way "stack them up" in advance.
code following:
struct location { let title: string let subtitle: string let imagename: string let latitude: double let longitude: double } let locations = [ location(title: "ben", subtitle: "the big", imagename: "de.png", latitude: 56.888214, longitude: 14.779658), location(title: "adam", subtitle: "bervesiell", imagename: "be.png", latitude: 56.588224, longitude: 14.779658), location(title: "david", subtitle: "downfall", imagename: "ce.png", latitude: 56.888214, longitude: 14.579668) ] location in locations { let annotation = mkpointannotation() annotation.title = location.title annotation.subtitle = location.subtitle annotation.imagename = location.imagename annotation.coordinate = cllocationcoordinate2d(latitude: location.latitude, longitude: location.longitude) mapview.addannotation(annotation) } }
Comments
Post a Comment