Reputation: 8508
I'm looking for a way to allow the user of my iPhone app to place labels on top of an image, and save the final result into a new image.
I've tried looking around, but so far I'm not 100% sure how should I start implementing this feature, or if this is the right approach to do something like that.
Thank you.
Upvotes: 0
Views: 31
Reputation: 306
Use following snippet once ur code detects that User has entered the desired caption for an image:
AppDelegate* appDelegate = ( AppDelegate * ) [UIApplication sharedApplication].delegate;
UIGraphicsBeginImageContext(appDelegate.window.bounds.size);
[appDelegate.window.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData * data = UIImagePNGRepresentation(image);
// Save the data object to the the file.
Upvotes: 1