Question

I have an animation in a EAGLView which is itself in a UITableViewCell. How can I pause the animation in the EAGLView when the view is not visible?

Normally, I would simply use the responsible UIViewController and listen to viewDidDisappear. But how do I do that if the EAGLView is in a table?

Was it helpful?

Solution

I don't think that this is a task to implement at all. Once your cell is scrolled out of view, it will be deallocated instantly. So if you have a Custom Cell, the animation will have to be stopped in -dealloc anyhow.

EDIT 1: Actually, I was not really precise: I wrote "instantly", but of course, this depends on the OS and Apple and may be changed in future versions. Actually, the cell is deallocated whenever the OS garbage collector wants. Currently, Apple deallocates one cell whenever it needs a new one. Usually, scrolling a table implies that one row disappears and a new one appears, so that's why deallocation seems to happen instantly. If the view, that is switched on, contains a table view, than you will see the same instant deallocation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top