How can I set image to UIImage object. For example:
UIImage
UIImage *img = [[UIImage alloc] init]; [img setImage:[UIImage imageNamed:@\"anyImageName\"]]
You can't alloc UIImage, this is impossible. Proper code with UIImageView allocate:
UIImageView *_image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"something.png"]] ;
Draw image:
CGContextDrawImage(context, rect, _image.image.CGImage);