IOS uitableview Table View Scroll hide Uinavigationcontroller navigation bar

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.