I have a UITableView within UINavigationController. By default, its UINavigationBar on iOS is stationary. But I’ve seen some apps where the UINavigationBar moves up going out of the screen when the users scroll down. I can make this happen by manually adding the UINavigationBar to the header view of the UITableView. However, the UINavigationBar would also move down and retract along with UITableView. How can I make it so that the UINavigationBar only moves up out of the screen but never moves down below the top? Anyone?
I have a UITableView within UINavigationController. By default, its UINavigationBar on iOS is stationary.
Share
You must implement the
-(void)scrollViewDidScroll:(UIScrollView *)scrollViewmethod on your UITableView delegate, calculate how much to move the UINavigationBar (if any) and move it up. It will move up as the table view moves down.A similar technique is used in EGOTableViewPullRefresh to animate the refresh control, you can find it on GitHub.