在 iPhone 上加载多张图像
所以我有一个 UIButton,当按下该按钮时,会创建一个 UIView,其中包含 10 个 UIImageView,所有这些的大小均为 100x100。对于每个 UIImageView 都有一个尺寸为 640x960 的图像,我调整其大小以适合 UIImageView。我的问题是,每次按下按钮时,在创建 UIView 之前都会有 1-2 秒的延迟,但如果我删除 UIImageViews,一切都会正常工作。有人可以提供一些帮助吗?提前致谢。
So I have a UIButton, when said button is pressed a UIView is created which holds 10 UIImageViews, all of those have a size of 100x100. For every UIImageView there's an image with the size of 640x960, which I resize to fit the UIImageView. My problem is that every time I press the button there's a 1-2 second delay before the UIView gets created, but everything works fine if I remove the UIImageViews. Can anyone provide some help? Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
加载和调整 10 个 UIImageView 的大小会导致延迟。通过将图像大小预先调整为 100x100 来创建图像的缩略图版本,然后加载它们而不是大图像,并且延迟应该最小。
Loading and resizing 10 UIImageViews is going to cause delay. Create thumbnail versions of your images by pre-resizing them to 100x100 and load them instead of the large ones and there should be minimal delay.