0

Say I'm doing something with iOS 7's interactive view controller transitions, and I'm handed the toViewController and the fromViewController, where only the fromViewController is currently visible on screen.

If I wanted to get a snapshot of the fromViewController I could easily do it with:

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

But if I was looking for a snapshot including the status bar of toViewController, I'm not sure how I'd do that, as it's not visible on screen yet.

As for why, I'd like to slide the full view controller including the status bar to the right as part of the transition to pop it and slide the other full view controller in at the same time, both moving their respective status bars.

Is it possible to get a snapshot of a view controller that's not 100% visible?

Doug Smith
  • 29,668
  • 57
  • 204
  • 388
  • if your requirement is taking a snap shot of complete view controller is contains visible and non visible object to captured without status bar i can help.. if this is the case let me know.. – Charan Giri Apr 01 '14 at 04:02

1 Answers1

1

Not without manipulating the snapshot yourself to put it there using the UIScreen snapshot.

What you are doing is actually snapshotting the full screen of your app, NOT the view controller in question. In this case it happens to take up the full screen, but it is not typically what you would do.

The generally correct thing to do here is to take an image snapshot of the actual views themselves (viewController.view) and use those in your animation. This way, you let the application and view controllers handle the status bar coloring/animation on their own.

If you look at the way other apps handle this, particularly with the built-in transitions, there is generally only ever one instance of the status bar on the screen. If another view slides or animates in, the status bar appears/disappears/changes color, but a new one never animates over another one.

Dima
  • 23,484
  • 6
  • 56
  • 83
  • I was just exploring other options I guess. It's [seeming pretty difficult to replicate the default](http://stackoverflow.com/questions/22624780/how-would-i-begin-to-replicate-the-custom-view-controller-transition-apple-uses?rq=1). – Doug Smith Apr 01 '14 at 03:32
  • 2
    @DougSmith I just answered your other question on how to fix the lag in your animation. Very simple! – Dima Apr 01 '14 at 03:49