Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

erdinc27

macrumors regular
Original poster
Jul 20, 2011
168
1
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.
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 ?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.