PNG 和 UI 图像优化
是使用 PNG(例如 320px x 44px)并显示一次更好,还是使用 320px x 4px 的 PNG 并使用 [UIColor colorWithPatternImage:] 更好?
我知道iPhone可以很好地处理PNG并解压缩它们,因此就内存而言,最好使用尽可能小的图像,并且在这种情况下,使用UIColor方法来重复它?
使用 colorWithPatternImage 有什么缺点吗?也许在更大的区域,也许是半个屏幕大小或全屏幕大小?
非常感谢,
迈克尔
Is it better to have a PNG, say 320px x 44px and display it once, or to have a PNG that is 320px x 4px and use [UIColor colorWithPatternImage:]?
I know that the iPhone handles PNGs well and decompresses them, so in terms of memory, would it be best to use the smallest possible images, and in this case, use the UIColor method to repeat it?
Are there any drawbacks to using colorWithPatternImage? Perhaps over larger areas, maybe half a screen size or full screen sized?
Many thanks,
Michael
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我敢打赌,选择其中之一不会对您的应用程序的响应能力产生明显的影响。人们可能注意到差异的唯一地方是他们是否通过 EDGE 下载您的应用程序,在这种情况下,平铺图像就是最佳选择。
我会尽一切努力使您的应用程序最易于维护。
I'm willing to bet that choosing one over the other won't make a noticeable difference in your app's responsiveness. The only place people might notice a difference is if they're downloading your app over EDGE, in which case the tiled image is the way to go.
I would do whatever makes your app most maintainable.
答案取决于“更好”对您意味着什么。如果您更关心应用程序的大小,那么较小的图片会对您有所帮助。如果应用程序的速度比大小更重要,那么较大的图像将消除对所有 colorWithPatternImage 调用的需要,并且实际上运行得更快。
The answer depends on what "better" means to you. If you're more concerned about the size of the app, then smaller pictures would help you. If the application's speed is more of an issue than size, then a larger image will eliminate the need for all the colorWithPatternImage calls and effectively run faster.