在 UITableViewCell 中的 EAGLView 中暂停动画
我在 EAGLView 中有一个动画,它本身在 UITableViewCell 中。当视图不可见时,如何暂停 EAGLView 中的动画?
通常,我会简单地使用负责的 UIViewController 并监听 viewDidDisappear。但是如果 EAGLView 在表中,我该怎么做呢?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这根本不是一个需要执行的任务。
一旦您的单元格滚动到视图之外,它将立即被释放。
因此,如果您有一个自定义单元格,则动画无论如何都必须在 -dealloc 中停止。
编辑1:
实际上,我并不是很精确:我写的是“立即”,但是当然,这取决于操作系统和Apple,并且可能会在未来版本中更改。实际上,只要操作系统垃圾收集器需要,单元就会被释放。目前,只要苹果需要一个新的单元,就会释放一个单元。通常,滚动表格意味着一行消失并出现新行,因此这就是释放似乎立即发生的原因。
如果打开的视图包含表视图,那么您将看到相同的即时释放。
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.