i have an invisible small view and a CollectionView in my main view. i want to make the small view visible when collectionView scrolled up and hide it back when it is scrolling down. Just like in Facebook's android application. i wrote something like this. it works good in simulator but not in real device. in real device the small view flashes when it is visible.
so how can i do that ?
Code:
- (void) scrollViewDidScroll:(UIScrollView *)scrollView
{
self.currentPositionCollectionView = scrollView.contentOffset.y;
if (self.currentPositionCollectionView > self.previousPositionCollectionView)
{
[UIView animateWithDuration:0.5f animations:^{
self.altView.frame = CGRectMake(0, 750, ALTVIEW_WIDTH, ALTVIEW_HEIGHT);
}];
}
else
{
[UIView animateWithDuration:0.5f animations:^{
self.altView.frame = CGRectMake(0, 630, ALTVIEW_WIDTH, ALTVIEW_HEIGHT);
}];
}
self.previousPositionCollectionView = self.currentPositionCollectionView;
}
so how can i do that ?