标签:
CGRect rect = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 64);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
UIColor *color = [UIColor colorWithRed:41/255.0 green:182/255.0 blue:246/255.0 alpha:1.0];
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
此时 img 就是生成的图片
标签:
原文地址:http://www.cnblogs.com/dewengood/p/5141186.html