Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mapview is updating the map when window/sheet isn't visible #5

Open
dustinrue opened this issue Mar 5, 2012 · 6 comments
Open

mapview is updating the map when window/sheet isn't visible #5

dustinrue opened this issue Mar 5, 2012 · 6 comments

Comments

@dustinrue
Copy link
Contributor

I've integrated MacMapKit into my app and I'm finding that my MKMapView is updating the map even if the map isn't visible and in fact never has been (window is closed). In fact, it is updating even before I've even started asking for location information.

Is this expected behavior and if so, how do I prevent it?

@dustinrue
Copy link
Contributor Author

Simply adding a custom view to a window, setting the custom class to MKMapView and then loading the xib, without making it visible, will generate at least 3% CPU usage on a 2.4Ghz C2D 2010 13" MBP. This nearly destroys battery life when the machine is idle.

@rickfillion
Copy link
Member

That's interesting... I don't see that in Sidekick. Wonder what would cause that.

@dustinrue
Copy link
Contributor Author

Well for one I never actually destroy the window/view that has the map on it. If that helps

@rickfillion
Copy link
Member

You could try calling [mapView setShouldUpdateWhileOffscreen: NO];. If that works, i'll make that the default.

@dustinrue
Copy link
Contributor Author

I wasn't aware that that was a thing, I'll try it, thanks

@rickfillion
Copy link
Member

Errr... I lied. I thought my map view inherited from WebView, it doesn't.

As a simple test:
WebView *webView = [mapView valueForKey:@"webView"];
[webView setShouldUpdateWhileOffscreen: NO];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants