UITableView inherited from Uiscrollview
So Uiscrollview's Proxy method is also suitable for UITableView
The way to hide the navigation bar is:
self.navigationController.navigationBar.hidden = YES;
So we only have to monitor the scrolling direction of the scrolling view to control whether the navigation bar is displayed or hidden by scrolling the proxy method:
To do this by implementing the Uiscrollview Proxy method:
Here's how:
//Slide ScrollView, and the finger is left to perform. A valid slide, executed only once. //When the Pagingenabled property is yes, it is not called, the method-(void) Scrollviewwillenddragging: (Uiscrollview*) ScrollView withvelocity: (Cgpoint) Velocity Targetcontentoffset: (inoutCgpoint*) targetcontentoffset{NSLog(@"%f", Velocity. Y);if(Velocity. Y>0.0) {//Swipe up to hide the navigation bar Self. Navigationcontroller. Navigationbar. Hidden=YES; }Else{//Swipe down to display the navigation bar Self. Navigationcontroller. Navigationbar. Hidden=NO; }}
If you feel the effect is stiff, you can load the animation effect yourself!
A detailed explanation of Uiscrollview Delegate is available here: IOS uiscrollviewdelegate in detail
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
IOS uitableview Table View Scroll hide Uinavigationcontroller navigation bar