4

Like you can see in the title: I'd like to change the compass image displayed in my MapView.

I'm creating a MKCompassButtonView using these lines:

let compassBtn = MKCompassButton(mapView:MapView)
compassBtn.frame.origin = CGPoint(x: 25, y: 25)
compassBtn.compassVisibility = .visible
MapView.addSubview(compassBtn)

... but how can I edit the compass image? (Changing the color / etc. is possible but I'd like to set my own compass image)

img

Using some code like this:

compassBtn.image = UIImageView(UIImage(named: "myImage"))

.... is still not working "compassBtn" has no member ".image".

Any help would be very appreciated.

Jonas0000
  • 1,085
  • 1
  • 12
  • 36
  • The one which you have pointed out is the location icon. Below the location icon is the compass icon – Nitish Feb 12 '18 at 19:53
  • Yeah you're right but I have not pointed on this image. I've searched for 'map compass ios' and this was the first image popping up :) @Nitish – Jonas0000 Feb 12 '18 at 19:55

1 Answers1

0

You can't edit it as it the default MK Compass Button provided by Apple, if you read the docs at : MK Compass Button you can check theres no functions or methods to change the image, if you want to change the image just create your own view in that corner with 2 buttons that share the same height inside.

Sung
  • 434
  • 5
  • 17