PDA

View Full Version : How to hide the compass (instantly)



Conaaando
06.07.2014, 05:13
Hi,

I'm showing and hiding the compass like so:

self.mapView.settings.showCompass = YES;
self.mapView.settings.showCompass = NO;

It works, but only after I drag the map around.

This wouldn't be good from a UX perspective (for example, if there was a menu where users could tap to hide / show the compass).

I also tried to hide / show the compass on the main thread, like so:

dispatch_async(dispatch_get_main_queue(), ^{
self.mapView.settings.showCompass = NO;
});

But no luck.

I wonder, is it by design? Would there be anything I could do?

Thanks.

dandronic
15.07.2014, 17:22
The behaviour you are experiencing is a bug ("showing/hiding the compass did not trigger a map render") - it will be fixed in a future release.

A workaround for this would be simply setting the visible region to the current visible region.
self.mapView.visibleRegion = self.mapView.visibleRegion;

Conaaando
15.07.2014, 17:35
Cool, I got it. Thanks for replying.