I am trying to use a command in iOS8 to enable behaviour to hide navigation bar when scrolling.
Here is the code
-(void)viewDidAppear:(BOOL)animated 
{
    self.navigationController.hidesBarsOnSwipe = YES;
}
And when scrolling up quick, there is no problem because the navigation bar will be dragged down and visible automatically. But in the even if I scroll up to the top slowly. The navigation bar does not show.
I tried to correct this behavior by using scrollView delegate. But that does not work well also. Because the animation does not look nice.
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if(floor(NSFoundationVersionNumber) >= NSFoundationVersionNumber_iOS_8_0)
{
    float scrollOffset = scrollView.contentOffset.y;
    if (scrollOffset < 10)
    {
        self.navigationController.navigationBarHidden = NO;
    }
}
}
Please help. I would like to do this as simple as possible. Thanks in advance
To show when it has reached the top, use the following
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
  if indexPath.row == 0 {
    self.navigationController?.hidesBarsOnSwipe = false
    self.navigationController?.setNavigationBarHidden(false, animated: true)
  } 
  else {
    self.navigationController?.hidesBarsOnSwipe = true
}
I just faced same problem.
When i used hidesBarsOnSwipe property of UINavigationController. 
I can not show it again on scroll/swipe. 
In my case i was using UIScrollView and scrollview's top was Aling to SafeArea.Top
I just changed scrollview's Top to
SuperView.Top, and its works.
Thanks.
I had a UIScrollView with the right constraints on the top, but still its behavior was weird.
I solved in this way:
-(void)scrollViewDidScroll: (UIScrollView*)scrollView
{
    float scrollViewHeight = scrollView.frame.size.height;
    float scrollContentSizeHeight = scrollView.contentSize.height;
    float scrollOffset = scrollView.contentOffset.y;
    if (scrollOffset < 0) 
    {
        self.navigationController.hidesBarsOnSwipe = NO;
        [self.navigationController setNavigationBarHidden:NO animated: YES];
    }
    else
    {
        self.navigationController.hidesBarsOnSwipe = YES;
    }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With