[Code Note] generates a solid color image by color,
I ,.
Ii. Code.
RootViewController. m
-(Void) viewDidLoad {[super viewDidLoad]; // Do any additional setup after loading the view. UIImageView * imageView = [[UIImageView alloc] initWithFrame: CGRectMake (50,100,200,200)]; imageView. backgroundColor = [UIColor yellowColor]; imageView. image = [self buttonImageFromColor: [UIColor redColor]; [self. view addSubview: imageView];} // generate a solid color image by color-(UIImage *) buttonImageFromColor :( UIColor *) color {CGRect rect = CGRectMake (0, 0, self. view. frame. size. width, self. view. frame. size. height); UIGraphicsBeginImageContext (rect. size); CGContextRef context = UIGraphicsGetCurrentContext (); CGContextSetFillColorWithColor (context, [color CGColor]); CGContextFillRect (context, rect); UIImage * img = Response (); Response (); return img ;}