How do I go about saving a portion of the graphical context without disturbing the user?

My situation is like this, I want to programmatically take a print screen of the current view visible to the user and save this to the photo album. The problem is that I don't want all of the views in the hierarchy to be visible. My plan was to:

  1. Make a copy of the view hierarchy.
  2. Hide the subviews which were not interesting.
  3. Take the print screen.
  4. Save it to the photo album.

The problem is that I'm stuck on the first point. Since UIView does not implement the NSCopying protocol I can't make a deep copy of the view hierarchy. I tried archiving and unarchiving the views but this was only available on the dektop.

As I see it there there are two options here: a) Implement the NSCopying protocol on all the views and subviews. b) Fade a white view covering the whole screen (sort of like the flash-effect when you take a print screen manually) and in that instant I hide the views I want.

Is there some other way of approaching this problem that I have missed?

Edit:

    UIGraphicsBeginImageContext([[wordManager mainWorkViewController] view].frame.size);  
    [[[[wordManager mainWorkViewController] view] layer] renderInContext:UIGraphicsGetCurrentContext()];   
    UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();    
    UIGraphicsEndImageContext();

Best regards //Abeansits

Answers


So, unfortunately no one was able to provide any help on this matter. How I solved the problem:

I removed the elements which I did not want in the print screen. I did this using animations so there would be no graphical flicker. In the end it looked pretty good, to bad I never solved the original problem.

Please post a fix if any one finds one. Best regards

//Abeansits


Need Your Help

PHP/CSS - detect nl2br breaks

php javascript mysql sql css

I have an array of various input boxes, that when filled, fills up the database with information. Then, from another file, I take the information and print it out to the screen.

C programming: Using a variable inside another variable name (not sure of the technical term)

c variables

I don't know what the technical term is but I would like to do following: