标签:
UIImage *oldImage = [UIImage imageNamed:@"car"]; //旧图片的尺寸和View不匹配,使用Quartz2D生成新图片 UIGraphicsBeginImageContextWithOptions(self.view.frame.size, NO, 0.0); [oldImage drawInRect:self.view.bounds]; UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); //将用图片的颜色来设置View的背景颜色 self.view.backgroundColor = [UIColor colorWithPatternImage:newImage];
标签:
原文地址:http://my.oschina.net/u/2285956/blog/362421