开发者

colorWithPatternImage Vs. UIImageView

Which is better to use if I simply wa开发者_运维百科nt a background image for a UIView? I can accomplish this with either method, but which is more efficient? My hunch is that using a UIView with colorWithPaternImage is more efficient than using a UIImageView. I'll be using this for each row in a UITableView. Thanks! Matt


Completely disagree with boreas. There can be significant differences using colorWithPatternImage vs other strategies depending on your requirements. For example, if you are using a UIScrollView, using colorWithPatternImage won't allow the image to scroll. It also generally depends on how large your view is because there is some tradeoff in performance vs memory footprint for different tiling strategies.

Check out WWDC 2010 session 104 which discusses tiling performance using CATiledLayer. This is a good high-performance alternative to using either the built-in colorWithPatternImage or CGContextDrawTiledImage.

If your requirement is simply to display a single 320x480 static image, then there won't be any significant differences in the various strategies, but if your requirements are more complex then there certainly are.


Yes, there is a UIView there anyway, so why bothering with another UIImageView?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜