简体   繁体   中英

hidesBarsOnSwipe doesn't work

Have a following structure:

UIViewController ( VC ) with some UIViews ( views ) on the top half of screen and UITableView ( tableView ) on the bottom half of screen. All are on the same hierarchy level within VC's view.

VC is managed by UINavigationController .

Auto-layout is off. Using autoresizing masks.

dataSource and delegate methods are set up and works fine.

What I want to realize:

Hide a navigation bar when scroll up and show in after the scroll down.

What I did:

Since my project supports iOS8+ only, just setting:

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];

    self.navigationController.hidesBarsOnSwipe = YES;
}

should be fine.

What I have:

  1. Swiping up and down on the views hides and shows navigation bar respectively.
  2. Scrolling tableView makes no sense.

Spent some time on that and found that resizing tableView to make it match to vc's view solves the problem.

Edit:

  1. Is it mentioned somewhere in the docs that table view should be only full screen?

  2. Found interesting thing: even if you didn't set hidesBarsOnTap to YES and try to tap on navigation area (ie when it's still hidden after swipe) - navigation bar will show after that. Very annoying if you have any UI elements in that area.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM