0

I'm taking screen captures like this:

UIView *snapshot = [[UIScreen mainScreen] snapshotViewAfterScreenUpdates:YES];

Is there any way I could place something on the screen (like by adding a UIView), take a snapshot as above that includes this item, and then remove this item, in such a way that the user never actually sees the briefly-added item?

MusiGenesis
  • 74,184
  • 40
  • 190
  • 334
  • You could render the snapshot view to an image context, then render your extra view onto that image context giving you the composite image you want. – rmaddy Mar 12 '14 at 05:09
  • @rmaddy: well, that's not really what I'm trying to do here. As a side note, though, the thing returned by `snapshotViewAfterScreenUpdates` is not a "real" iOS `UIView` - any attempt to take a snapshot of it (by any means) just gives you solid black. – MusiGenesis Mar 12 '14 at 05:43
  • do you want to just capture the view which have objects,Does the captured screen shot will display all elements/objects or visible objects which are on the view. – Charan Giri Mar 12 '14 at 06:28

1 Answers1

0

The best way to do this is to take the screenshot and then copy that something in after you do the screenshot.

Hopefully that something is something that has static content, and that way you won't have to make something's UIView visible. You can use a technique like one that is described in this related question.

Community
  • 1
  • 1
Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • Unfortunately, I need a snapshot of the status bar specifically. I'm attempting to show the status bar, get a snapshot of it and then hide it again without the user's ever seeing it. I think I'm on a fool's errand. – MusiGenesis Mar 12 '14 at 05:41
  • 1
    maybe you can take a screenshot of the status bar at a *different* time (e.g. when the app first launches, before you programatically hide it) and then save the status bar screenshot to clip and paste it over your new screenshot? – Michael Dautermann Mar 12 '14 at 05:49