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:
Spent some time on that and found that resizing tableView to make it match to vc's view solves the problem.
Edit:
Is it mentioned somewhere in the docs that table view should be only full screen?
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.