colorWithPatternImage vs CGImage vs UIImageView

时间:2013-10-20 17:58:57

标签: ios ios7

我在很多论坛上都看到你不应该使用colorWithPatternImage来解决内存问题,如果你使用的是大型背景图像并添加为子视图来节省内存,你应该使用UIImageView。我尝试了这三种解决方案,所有这些解决方案都显示了相同的内存:

// First Option
UIImageView *backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Background"]];
[self.view addSubview:backgroundView];
[self.view sendSubviewToBack:backgroundView];

//Second Option
UIImage *image = [UIImage imageNamed:@"Background"];
self.view.layer.contents = (id) image.CGImage;

//Third Option
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Background"]];

我正在使用iOS7 SDK。我有什么遗漏或iOS7在这方面有所改进吗?

0 个答案:

没有答案
相关问题