timunrue
6/10/2016 - 12:06 PM

Hide status bar programmatically with animation

Hide status bar programmatically with animation

-(void)hideStatusbar{ 

      [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade]; 

      [UIView beginAnimations:@"Statusbar hide" context:nil]; 
      [UIView setAnimationDuration:0.5]; 

      [self.view setFrame:CGRectMake(0, 0, 320, 480)]; 
      [UIView commitAnimations]; 
} 


- (void)viewDidLoad { 
      [super viewDidLoad]; // hideStatusbar called after 2 seconds 
      
      [self performSelector:@selector(hideStatusbar) withObject:nil 
         afterDelay:2.0];
}