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

How will views (created in custom renderer) be notified of appearing / disappearing?

$
0
0

I have a NavigationPage where I navigate from one page to another.
On the first page I have a custom control with a custom renderer which is creating some views. One of the views is a OpenGL view where I create a CADisplayLink to have a drawView method called every frame.
When navigating to the next page - I need to stop this CADisplayLink (as well as other resource management handling).

Any suggestions on how to let the view know that it's not visible anymore?

The only way I can think of is to override OnDisappearing() on the Page, get the custom element/control, set a property on the control (IsDisappearing = true or something), Check for this property changing in OnElementPropertyChange in the custom renderer, which is turn have a reference to my view. But Phew! That seems like a lot of work and complexity. (I haven't actually tried if it works).

Any insights?

Thanks in advance.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



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