简体   繁体   English

检测UIImage是否已预加载?

[英]Detect if UIImage is preloaded?

I am working on an image viewer application. 我正在研究图像查看器应用程序。 I noticed some lag when scrolling and discovered this code to solve the problem: 我在滚动时注意到一些滞后,并发现以下代码可以解决问题:

https://gist.github.com/steipete/1144242 https://gist.github.com/steipete/1144242

Basically, it just draws the UIImage, to preload/cache it, making the scrolling nice and smooth. 基本上,它只是绘制UIImage来预加载/缓存它,从而使滚动变得顺畅流畅。

Is there anyway to detect whether a given UIImage is preloaded? 无论如何,有没有检测给定的UIImage是否已预加载?

Asked at WWDC, there isn't a way to tell. 在WWDC上被问到,没有办法说出来。 So I used associated objects attached to my UIImage to track whether it was preloaded or not. 因此,我使用附加到UIImage的关联对象来跟踪它是否已预加载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM