-(UIImage *)createColorImage:(UIColor *)color
{
// 使用颜色创建UIImage
CGSize imageSize = CGSizeMake(MAIN_SCREEN_WIDTH, MAIN_SCREEN_HEIGHT);
UIGraphicsBeginImageContextWithOptions(imageSize, 0, [UIScreen mainScreen].scale);
[color set];
UIRectFill(CGRectMake(0, 0, imageSize.width, imageSize.height));
UIImage *pressedColorImg = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return pressedColorImg;
}
转载于:https://my.oschina.net/u/2346786/blog/665940