I have this snippet of code:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
UINavigationBar *navbar =self.navigationController.navigationBar;
UIView *tableView = self.view;
CGRect navBarFrame = self.navigationController.navigationBar.frame;
CGRect tableFrame = self.view.frame;
//changing the origin.y based on the current scroll view.
//Adding +20 for the Status Bar since the offset is tied into that.
navBarFrame.origin.y = MIN(0, MAX(-44, (scrollView.contentOffset.y * -1))) +20 ;
tableFrame.origin.y = navBarFrame.origin.y + navBarFrame.size.height;
navbar.frame = navBarFrame;
tableView.frame = tableFrame;
}
this gives the desired effect of hiding my navigation bar, but the navigation will only re-appear if you scroll to the top of the scrollview (y offset = 0). how can I recreate Instagram's behaviour where the navbar reappears whenever you scroll up?