-2

I wanted to add emoticons, images in single image like we do in Snapchat and save the image with all the images added.

I have done adding, rotating, pinch, zoom functionality, but how to save the image with all the images added with their position is the point where I'm stuck.

halfer
  • 19,824
  • 17
  • 99
  • 186
Akshaykumar Maldhure
  • 1,239
  • 1
  • 18
  • 32
  • `how to save the image with all the images added` That could depend on how you create this image. Please show the relevant code in your question. – Eric Aya Jan 12 '17 at 16:14

2 Answers2

1

Try something like this:

UIGraphicsBeginImageContext(view.frame.size)
view.drawViewHierarchyInRect(view.frame, afterScreenUpdates: true)
let newImage:UIImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()

This allows you to kind of 'screenshot' of the screen or a part of it. it takes the viewHierarchy shown on screen within the given frame and captures it as a new image. regardless of layers.

Scriptable
  • 19,402
  • 5
  • 56
  • 72
1

Do you want to take a screenshot of the whole view and save it as one image ? for that you could use this https://stackoverflow.com/a/18925301/1480331

If not, then you have to create some kind of template that would save the locations, rotations, sizes and all the details so you could render them later.

Community
  • 1
  • 1