How to hide top bar when dragging?

| | August 18, 2015

I have this code and it works with tabbar. How could I do the same thing for top bar ?

There’s the code for tabbar:

-(void)scrollViewDidScroll:(UIScrollView *)scrollView {

    NSInteger yOffset = scrollView.contentOffset.y;
    if (yOffset > 0) {
        self.tabBar.frame = CGRectMake(self.tabBar.frame.origin.x, self.originalFrame.origin.y + yOffset, self.tabBar.frame.size.width, self.tabBar.frame.size.height);
    }
    if (yOffset < 1) self.tabBar.frame = self.originalFrame;
 }

Leave a Reply