hacker
hacker

Reputation: 8947

hiding the navigation bar like instagram or Facebook in iPhone?

I had an application in which I want to hide my navigation bar when scrolling upwards in a UITableView. I am doing like this

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

    //Initializing the views and the new frame sizes.
    UINavigationBar *navbar = self.navigationController.navigationBar;
    UIView *tableView = self.view;

    CGRect navBarFrame = self.navigationController.navigationBar.frame;
    CGRect tableFrame = self.view.frame;

    //changing the origin.y based on the current scroll view.
    //Adding +20 for the Status Bar since the offset is tied into that.
    navBarFrame.origin.y = MIN(0, (sender.contentOffset.y * -1)) +20;
    navbar.frame = navBarFrame;

    tableFrame.origin.y = MIN(0,MAX(-44,(sender.contentOffset.y * -1)));
    tableView.frame = tableFrame;    
}

But the problem is that it is moving completely upwards in iOS 7. I need it to be stopped under the status bar and the status bar is shown there.

Upvotes: 4

Views: 13768

Answers (1)

Apple_Magic
Apple_Magic

Reputation: 477

https://github.com/ninjinkun/NJKScrollFullScreen ...Hope this will help any other

Upvotes: 1

Related Questions