Skip to content

Instantly share code, notes, and snippets.

@wanggang316
Created June 13, 2014 07:01
Show Gist options
  • Save wanggang316/032060c000390c26d284 to your computer and use it in GitHub Desktop.
Save wanggang316/032060c000390c26d284 to your computer and use it in GitHub Desktop.
__block BOOL flag = YES; //0 up 1 down
UINavigationBar *navbar = [[self navigationController] navigationBar];
[UIView animateWithDuration:0.3 animations:^(void)
{
if ([[UIApplication sharedApplication] respondsToSelector:@selector(setStatusBarHidden:withAnimation:)]) {
[[UIApplication sharedApplication] setStatusBarHidden:flag withAnimation:NO];
}
if (flag) {
navbar.frame = CGRectMake(0, -44, 320, 44);
}
else {
navbar.frame = CGRectMake(0, 20, 320, 44);
}
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment