Example project: http://cl.ly/0O2t051o081p
I want to achieve a slide-out sidebar as described in this question where the status bar moves as well. I've got everything working and the sidebar slides, but as soon as I try to hide the status bar with to complete the "illusion" it stops anything from happening at all and the sidebar no longer slides out.
Here's my code:
- (void)viewDidAppear:(BOOL)animated { double delayInSeconds = 1.0; dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ [self.PostsView addSubview:[[UIScreen mainScreen] snapshotViewAfterScreenUpdates:NO]]; hide = YES; [self setNeedsStatusBarAppearanceUpdate]; [UIView animateWithDuration:1.0 animations:^{ CGRect postsFrame = self.PostsView.frame; postsFrame.origin.x = self.MenuView.frame.size.width; self.PostsView.frame = postsFrame; }]; }); }
Where my code basically consists of a containing view controller that contains two child view controllers (the main view controller and the sidebar view controller) built in the Storyboard.
I've also tried setting View controller-based status bar appearance
in the plist to NO
and calling [[UIApplication sharedApplication] setStatusBarHidden]
but the exact same result happens where it breaks.
What am I doing wrong?