Moving status bar in iOS 7

Gyfis picture Gyfis · Sep 25, 2013 · Viewed 14.6k times · Source

The problem I'm facing is this:

I want to implement an iOS 7 app with nice design and left/right menu, which appears after the main view animate itself to the right/left. I'm doing this with [UIView animateWithDuration...] code, but that's not really important. What I want to achieve is the same effect the Mailbox iOS 7 app has: to move the status bar away (to the right/left) with the main view

Image for better explanation:

Mailbox app with status bar moved to the side

What I only found is this article about the issue, with some working code using Private APIs, which I'd like not to use, since I want my app to be accepted on the App Store.

I'd like to achieve the same effect ('legally'). Does anybody knows how to?

Thanks!

Answer

Simon Holroyd picture Simon Holroyd · Sep 25, 2013

The gist of it is to use this method introduced in iOS 7:

https://developer.apple.com/documentation/uikit/uiscreen/1617814-snapshotview:

With that you get a UIView containing a screenshot that includes the status bar. Once you have that, it's just a matter of hiding your current view then pushing the screenshot view around.

I posted a proof of concept here: https://github.com/simonholroyd/StatusBarTest

NOTE I haven't submitted code that does this through the Apple review process, but this is not a private API method.