哪个更快?使用石英和CGRects 与数组 UIImageViews
只是想知道如果你有很多(大约几百到一千)2D 图像,使用 Quartz 或 UIImageViews 数组会更快。干杯!
Just wondering weather its faster, if you have lots (~several hundred to a thousand) 2D images, to use Quartz or an array of UIImageViews. Cheers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Quartz 是较低级别的绘图引擎,因此从理论上讲,Quartz 函数至少与 UIKit(依赖于 Quartz)中的功能一样快。但话虽如此,我想您不打算在 iPhone 屏幕上同时显示数百张图像吧?创建数百个 UIImageView 不太可能提高内存效率,您可能会想采用另一种方式。如果您一次只在屏幕上显示几个 UIImageView,那么您可以重用它们,问题就消失了。
Quartz(Core Graphics,我假设您指的是自定义
-drawRect:
)和 UIImageView 之间还有其他选项。您还可以使用 CALayers,它速度非常快并且内存效率很高。Quartz is the lower-level drawing engine, so in theory, Quartz functions will be at least as fast as things from UIKit (which relies on Quartz). But that said, I assume you don't plan to show several hundred images simultaneously on the iPhone screen? Creating hundreds of UIImageViews is unlikely to be memory efficient, and you'd want to go another way. If you only show a few UIImageViews on the screen at a time, then you can reuse them, and the question goes away.
There are other options between Quartz (Core Graphics and I assume you mean a custom
-drawRect:
) and UIImageView. You can also use CALayers, which are quite fast and memory efficient.