TLYShyNavBar icon indicating copy to clipboard operation
TLYShyNavBar copied to clipboard

Issue when using scroll from child view controller

Open dron4eeek opened this issue 11 years ago • 7 comments
trafficstars

It is really cool component, great gob. I am using it on view controller which is using two collection views in scroll view added like a child view controllers, they are changing by swiping left or right. I set up everything like after scroll page changed i am seting shymanagers scroll and controller :

self.shyNavBarManager.scrollView = self.collectionViewFromChild;
[self.shyNavBarManager setViewController:rightCollectionViewController];

the same for right.

its working fine on scrolling up, navigation bar hides cool.

The problem is that when I am scrolling down and scroll offset goes under status bar a bit and i begin to scroll down navigation bar begin to appear, but it should appear only when offset y reached the status bar height. Than in expands with out animation. Video: https://www.dropbox.com/s/x024oe0hkydlfyx/bug.mp4 Please help me with this problem. How I can fix it?

Thank you!

dron4eeek avatar Jul 24 '14 15:07 dron4eeek

Thanks for reporting the issue!

So, as far as I can tell, there are two issues here:

  1. The navbar "sticks" to the collection view when you scroll up a bit, then scroll down. It should not stick, and wait till the collection view's bounds origin aligns with the contracted navbar.
  2. The navbar is acting weird in some cases where it should animate, but it isn't. Instead, it shrinks and expand without animation.

So, regarding 1, did you change the expansionResistance to 0? That might be an issue if you did, otherwise, I am actually able to reproduce the issue, so it is valid.

Regarding 2, I'll take a look.

Mazyod avatar Jul 25 '14 08:07 Mazyod

Yes, i am changing expansionResistance after changing collections (after swiping) like this


- (void)updateScrollViewCollectionsWithType:(enum State)state
{
  [self.shyNavBarManager prepareForDisplay];
  if (state == State1)
  {
    self.shyNavBarManager.extensionView = self.searchBar;
    self.collectionViewFromChild = leftCollectionViewController.collectionView;
    [self.scrollView setContentOffset:CGPointZero animated:YES];
    self.shyNavBarManager.scrollView = self.collectionViewFromChild;
    [self.shyNavBarManager setViewController:leftCollectionViewController];
    self.shyNavBarManager.contractionResistance = 0;
    self.shyNavBarManager.expansionResistance = 200;
    [rightCollectionViewController.collectionView setContentOffset:CGPointMake(0, valueForScrollUP) animated:NO];
    [leftCollectionViewController pullToRefresh];
  }
  else
  {
    self.collectionViewFromChild = rightCollectionViewController.collectionView;
    [self.scrollView setContentOffset:CGPointMake(self.leftCollectionView.frame.size.width, 0) animated:YES];
    self.shyNavBarManager.scrollView = self.collectionViewFromChild;
    [self.shyNavBarManager setViewController:rightCollectionViewController];
    self.shyNavBarManager.contractionResistance = -self.searchBar.height;
    self.shyNavBarManager.expansionResistance = 200 -self.searchBar.height;
    [leftCollectionViewController.collectionView setContentOffset:CGPointMake(0, valueForScrollUP) animated:NO];
  }
}

Thanks for reply!

dron4eeek avatar Jul 25 '14 10:07 dron4eeek

I am changing it because on one collectionview I need extensionView on other i dont need it, so second collection y is up to hide extensionView.

dron4eeek avatar Jul 25 '14 10:07 dron4eeek

I have found some dirty solution by adding childviewcontroller to navigation controller with hidden nav bar and then setting parentviewcontroller like shynavbarmanager and its work)

dron4eeek avatar Jul 25 '14 13:07 dron4eeek

@dron4eeek You may want to reevaluate setting the resistance to a negative value, I believe this would result in undefined behavior.

I'm glad you found a workaround! I am, however, still investigating the issue to see what could go wrong.

Mazyod avatar Jul 25 '14 15:07 Mazyod

Thank you for this work! Can I bind status bar with shyNavBarManager for hiding status bar when navigation bar hides?

av0c0der avatar Mar 30 '15 10:03 av0c0der

@Mazyod Any update on @Jauzee's question above?

vishaltelangre avatar Aug 24 '15 09:08 vishaltelangre