software-mariodiana
9/25/2019 - 8:50 PM

Create image in code.

UIGraphicsBeginImageContext(CGSizeMake(512.0, 512.0));

CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(ctx, [UIColor redColor].CGColor);
CGContextFillRect(ctx, CGRectMake(0.0, 0.0, 512.0, 512.0));
UIImage* myImage = UIGraphicsGetImageFromCurrentImageContext();
    
UIGraphicsEndImageContext();