1》//滑动隐藏导航栏,简书效果
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
CGPoint translation = [scrollView.panGestureRecognizer translationInView:scrollView.superview];
[self.navigationController setNavigationBarHidden:translation.y<0 animated:YES];
NSLog(@"ContentOffset x is %f,yis %f",translation.x,translation.y);
}
《2》//滑动隐藏导航栏, 结束时两个方向有速度,才执行
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
CGPoint translation = [scrollView.panGestureRecognizer translationInView:scrollView.superview];
[self.navigationController setNavigationBarHidden:translation.y<0 animated:YES];
NSLog(@"ContentOffset x is %f,yis %f",translation.x,translation.y);
}