显示图像的性能问题
我的问题是我有 50 张图像,每张图像都是 157X157 像素,占用 25kb。它们连接到滑块,当用户滑动滑块时,它们会从 0 更改为 100。它可以工作,但我的问题是 iphone 3g 和 3gs 非常慢,很难查看图像,有时会卡住一秒钟才能显示下一张图像。我使用 UIImageview 来显示图像。我怎样才能做得更好,以便视网膜显示屏之前的手机可以显示它们而不会卡住?感谢您的回答和您的时间。
编辑:所有图片都在它们不是从网址获取的文件中。
My problem is i have 50 images each is 157X157 pixels and take 25kb.They are connected to a slider and when the user slides the slider they change 0 to 100. It works but my problem is iphone 3g and 3gs is very slow its hard to see the images and sometimes it stuck for a second to show the next image. I use UIImageview to show the images.How can i do it better so the phone that before retina display can show them without stucking? Thanks for answers and your time.
edit: All pictures is in the file they are not taking from url.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当您的应用程序启动时预加载它们。向它们每个人发送一条
-size
消息应该足以强制它们加载。Preload them when your app launches. Sending each of them a
-size
message should be enough to force them to load.也许你可以预加载图片的低分辨率版本(例如 78px)
当滑块移动时,您显示低分辨率,当滑块停止时,您切换到原始图片。
Maybe you can preload a lowRez version of your pictures ( like 78px )
when the slider move, you display the lowRez, and when it's stop, you swap to original picture.
将它们转换为将要绘制的尺寸(不要即时重新缩放它们)。
ps:示例会有很大帮助
convert them to the size they will be drawn at (don't rescale them on the fly).
ps: a sample would help a lot