Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Rashii Henry
16,433 PointsSaving an Edited image using UIGraphicsBeginImageContext!
Im currently working on an app that allows you to drag an emoji image over an image you just took with the camera.
Everything works fine with the application, im just having trouble saving the context of the editted image.
here is my custom method below.
''
-(UIImage *)addEmoticon5 {
UIImage *selectedEmoticonImage = [UIImage imageNamed:@"dazed_face5"];
_emojiHolder = [_emojiHolder initWithImage:selectedEmoticonImage];
UIGraphicsBeginImageContext(_image.size);
[_image drawInRect:CGRectMake(0, 0, _image.size.width, _image.size.height)];
[selectedEmoticonImage drawInRect:CGRectMake
(_image.size.width - selectedEmoticonImage.size.width,
_image.size.height - selectedEmoticonImage.size.height,selectedEmoticonImage.size.width,
selectedEmoticonImage.size.height)];
UIImage *editedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return editedImage;
}
'
with emojiHolder being an imageView property of the ViewController and selectedEmoticonImage being the image they selected to place over the captured photo.
Could anyone provide me any assistance on how i can save the edited version of the photo to the photo library,
I already have it running fine saving the captured photo, but i cant seem to save it with the emoji overlay.
Thanks in advance!