在iPhone中隐藏像Instagram或Facebook这样的导航栏?

时间:2014-01-14 14:16:16

标签: ios iphone ipad uinavigationbar

我有一个应用程序,我想在UITableView向上滚动时隐藏导航栏。我这样做

- (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;    
}

但问题是它在iOS 7中完全向上移动。我需要在状态栏下停止它并在那里显示状态栏。

1 个答案:

答案 0 :(得分:1)

https://github.com/ninjinkun/NJKScrollFullScreen ...希望这会有助于其他任何