Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>So, after the initial push by Mr. Simon Holroyd and some searching, I've found the solution of how to achieve this "effect" functionality. This is the code:</p> <pre><code>statusbarView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 20)]; </code></pre> <p>EDIT: mister <strong>pcholberg</strong> correctly pointed out that the former code did not work on the actual device, only on the iOS Simulator, so I've edited it by his recommendation</p> <pre><code>if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) { UIView *screenShot = [[UIScreen mainScreen] snapshotViewAfterScreenUpdates:NO]; [statusbarView addSubview:screenShot]; [statusbarView setClipsToBounds:YES]; [self.view addSubview:statusbarView]; [self setPrefersStatusBarHidden:YES]; [self prefersStatusBarHidden]; [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)]; } </code></pre> <p>...</p> <pre><code>- (BOOL)prefersStatusBarHidden { return prefersStatusBarHidden; } </code></pre> <p>...</p> <p><br> So the first part creates context, uses the method Simon mentioned, draws the view with the statusbar, and saves that as an <code>UIImage</code></p> <p>The second part adds the snapshot <code>UIView</code> to my viewController's <code>UIView</code></p> <p>And the third part sets my bool for statusbar to YES (for easier use in the method above), and calls methods to redraw it</p> <p>This then sets the UIView as not-functional statusbar at its place and hides the original one, so there is no double-rendering. Then I can use this view in my <code>[UIView animateWithDuration...</code> method</p> <p>And when I return, I use this code in the completion handler of the animation block:</p> <pre><code>[statusbarView removeFromSuperview]; if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) { [self setPrefersStatusBarHidden:NO]; [self prefersStatusBarHidden]; [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)]; } </code></pre> <p>And voilá! This works as the described effect in my question.</p> <p><strong>Hope this helps somebody!</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload