Liam Ottley
Liam Ottley

Reputation: 25

Fixed MKAnnotation size

In my iOS app (swift 4) I want to have circle annotations (custom image) of a specific size, but I cannot find anywhere that explains how to fix the size/scale of an annotation regardless of map zoom.

When I zoom out I want them to all be small so you can view a large area without it being too cluttered, but when I zoom in close I don't want them to shrink and reveal the centre of the circle, as they currently do.

Is there any way to define the size of a custom annotation image?

Any help is greatly appreciated...

Upvotes: 1

Views: 1511

Answers (1)

Shehata Gamal
Shehata Gamal

Reputation: 100503

You can scale it if needed inside viewForAnnotation

annotationView?.transform = CGAffineTransform(scaleX: 0.5, y: 0.5)        
return annotationView

Upvotes: 1

Related Questions