Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Renderer disposed when navigating away from page

$
0
0

I am using a ViewRender for an iOS Map control. When the user navigates away from the page, using a MasterDetail layout, the render's dispose method is called and when they select the page again a new instance of the render is recreated. The instance of the page is not changed (ie. a new page is not created). This has the effect of recreating the iOS map when the user returns to the page, which is slow. What we would like to see is the same map (and therefore the same renderer) reused.

Is there a way to prevent the renderer from being disposed simply because the user has navigated to another page or is there a way to recycle the renders from a pool (although this would give problems in restore the previous state)?

The only solution I can see is to wrap the MKMapView object in another class, along with all the logic and state, and push these onto a static pool when the render is disposed and retrieve this, by popping from the pool, if a new render is created for the same map control.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>