You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two tabs, each contains one UICollectionView. I embed SVPullToRefresh in each UICollectionView as well. I set up the snapping by 0.5 threshold for BLK height bar.
tab 1 has 6 cells and tab 2 has 20 cells, so tab 2 could snap to progress 1, while tab 1 cannot.
My behaviour is copied from Facebook style behaviour:
the second line is to keep the BLKBar height consistent while switching between tabs. e.g. When the BLK height bar is at minimum height, I should keep it, so I need to update the offset when switching to target tab.
Steps:
First, I switch from tab 1 to tab 2; BLKBar is at progress 0;
when I am on tab 2, I scroll the UICollectionView, snap BLKBar to progress 1;
Then I switch to tab 1 by paning horizontally, ideally the BLK Bar should keep the snapping at progress 1, aka minimum height, however, I found it is at progress 0!
In order to debug, I subclass a HackUICollectionView to see what is happenning.
I setup my BLKBar minimum height is 64, max height is 108.
so while debugging, after targetCollection.contentOffset = CGPointMake(targetCollection.contentOffset.x, -CGRectGetHeight(self.BLKBar.frame));
is set to (0,-64),
there is one API called _adjustContentOffsetIfNecessary changed my contentOffset to -108:
If I override _adjustContentOffsetIfNecessary in sub class, it will not change it to -108 obviously, but I CANNOT fix my problem by this way because it is a internal API, I cannot simply pass through it.
Any idea why this happened? How can I keep the progress while switching UICollectionViews?
The text was updated successfully, but these errors were encountered:
I have two tabs, each contains one UICollectionView. I embed SVPullToRefresh in each UICollectionView as well. I set up the snapping by 0.5 threshold for BLK height bar.
tab 1 has 6 cells and tab 2 has 20 cells, so tab 2 could snap to progress 1, while tab 1 cannot.
My behaviour is copied from Facebook style behaviour:
everytime when switching tab, I will update the UICollectionView like this:
targetCollection.delegate = (id<UICollectionViewDelegate>)self.delegateSplitter; targetCollection.contentOffset = CGPointMake(targetCollection.contentOffset.x, -CGRectGetHeight(self.BLKBar.frame));
the second line is to keep the BLKBar height consistent while switching between tabs. e.g. When the BLK height bar is at minimum height, I should keep it, so I need to update the offset when switching to target tab.
Steps:
First, I switch from tab 1 to tab 2; BLKBar is at progress 0;
when I am on tab 2, I scroll the UICollectionView, snap BLKBar to progress 1;
Then I switch to tab 1 by paning horizontally, ideally the BLK Bar should keep the snapping at progress 1, aka minimum height, however, I found it is at progress 0!
In order to debug, I subclass a HackUICollectionView to see what is happenning.
I setup my BLKBar minimum height is 64, max height is 108.
so while debugging, after
targetCollection.contentOffset = CGPointMake(targetCollection.contentOffset.x, -CGRectGetHeight(self.BLKBar.frame));
is set to
(0,-64)
,there is one API called
_adjustContentOffsetIfNecessary
changed my contentOffset to -108:If I override
_adjustContentOffsetIfNecessary
in sub class, it will not change it to -108 obviously, but I CANNOT fix my problem by this way because it is a internal API, I cannot simply pass through it.Any idea why this happened? How can I keep the progress while switching UICollectionViews?
The text was updated successfully, but these errors were encountered: