简体   繁体   English

UIView背景-colorWithPatterOfImage或UIImageView?

[英]UIView background - colorWithPatterOfImage or UIImageView?

I'm wondering, what're the differences or, more importantly, what's better for performance - for a very fast redrawing: 我想知道,有什么区别,或更重要的是,什么对性能更好-快速重绘:

1) myView/myLayer.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"myImage.png"]]; 1) myView/myLayer.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"myImage.png"]]; for about 40 to 90 views/layers 约40至90个视图/层

or 要么

Just using about 40 to 90 UIImageViews ? 仅使用大约40到90个UIImageViews

What's better for fast redrawing and what's going under the hood, so I can understand which one to pick? 什么是快速重绘更好的选择,什么在引擎盖下进行,所以我可以理解该选择哪一个?

Thanks 谢谢

This previous post might help: colorWithPatternImage Vs. 一篇文章可能会有所帮助: colorWithPatternImage与。 UIImageView UIImageView

As well as this: http://cocoaintheshell.com/2011/01/colorwithpatternimage-memory-usage/ 以及以下内容: http : //cocoaintheshell.com/2011/01/colorwithpatternimage-memory-usage/

Consensus seems to be that colorWithPatternImage uses a lot of memory and to use UIImageView. 共识似乎是colorWithPatternImage使用大量内存并使用UIImageView。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM