Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

Issue when using scroll from child view controller #16

Open
dron4eeek opened this issue Jul 24, 2014 · 7 comments
Open

Issue when using scroll from child view controller #16

dron4eeek opened this issue Jul 24, 2014 · 7 comments
Labels

Comments

@dron4eeek
Copy link

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!

@Mazyod Mazyod added the bug label Jul 25, 2014
@Mazyod
Copy link
Contributor

Mazyod commented Jul 25, 2014

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.

@dron4eeek
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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)

@Mazyod
Copy link
Contributor

Mazyod commented Jul 25, 2014

@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.

@av0c0der
Copy link

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

@vishaltelangre
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants