I have collectionViewController and collectionViewCell include TableView.CollectionView is horizontal layout.I want hide navigationbar when scroll the tableView. Is there an
create a @property(assign, nonatomic) CGFloat currentOffset;
-(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
scrollView = self.collectionProductView;
_currentOffset = self.collectionProductView.contentOffset.y;
}
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
CGFloat scrollPos = self.collectionProductView.contentOffset.y ;
if(scrollPos >= _currentOffset ){
//Fully hide your toolbar
[UIView animateWithDuration:2.25 animations:^{
[self.navigationController setNavigationBarHidden:YES animated:YES];
}];
} else {
//Slide it up incrementally, etc.
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
}
Please don't forget to again paste [self.navigationController setNavigationBarHidden:NO animated:YES];
at - viewwilldisappear or whenever the controller is moving to another because this may cause next view controller navigation bar to disappear.