TabBar pull-up hidden, pull-up display implementation

Source: Internet
Author: User

PushListView.h@interfacepushlistview:uiview<uitableviewdelegate,uitableviewdatasource{cgfloat contentoffsety;      CGFloat oldcontentoffsety; CGFloat newcontentoffsety;} ............................... PUSHLISTVIEW.M//start dragging the view- (void) Scrollviewwillbegindragging: (Uiscrollview *) scrollview{contentoffsety=Scrollview.contentoffset.y;} //call this method when scrolling (after the finger leaves the screen)- (void) Scrollviewdidscroll: (Uiscrollview *) scrollview{//NSLog (@ "scrollview.contentoffset:%f,%f", Scrollview.contentoffset.x, Scrollview.contentoffset.y);newcontentoffsety=Scrollview.contentoffset.y; if(Newcontentoffsety > Oldcontentoffsety && oldcontentoffsety > Contentoffsety) {//Scroll upNSLog (@" up"); } Else if(Newcontentoffsety < oldcontentoffsety && Oldcontentoffsety < contentoffsety) {//Scroll downNSLog (@" Down"); } Else{NSLog (@"dragging"); }        if(scrollview.dragging) {//draggingNSLog (@"scrollview.dragging"); NSLog (@"contentoffsety:%f", contentoffsety); NSLog (@"newcontentoffsety:%f", SCROLLVIEW.CONTENTOFFSET.Y); if((scrollview.contentoffset.y-contentoffsety) >5.0f) {//drag up//hide the navigation bar and options Bar//[self layoutview];[_viewcontroller.navigationcontroller Setnavigationbarhidden:yes Animated:yes]; //[_viewcontroller.navigationcontroller Settoolbarhidden:!hidden animated:yes];_viewcontroller.tabbarcontroller.tabbar.hidden=YES; } Else if((CONTENTOFFSETY-SCROLLVIEW.CONTENTOFFSET.Y) >5.0f) {//drag down//Show navigation bar and options Bar//[self layoutview];[_viewcontroller.navigationcontroller setnavigationbarhidden:no Animated:yes]; //[_viewcontroller.navigationcontroller settoolbarhidden:no animated:yes];_viewcontroller.tabbarcontroller.tabbar.hidden=NO; } Else {                    }    }}//Complete the drag (call this method when scrolling stops, before the finger leaves the screen)- (void) Scrollviewdidenddragging: (Uiscrollview *) ScrollView willdecelerate: (BOOL) decelerate{//NSLog (@ "scrollviewdidenddragging");oldcontentoffsety=Scrollview.contentoffset.y;}

This is scorllview inside the method of judging the direction of the slide in the corresponding method to add hidden TabBar method can be.

TabBar pull-up hidden, pull-up display implementation

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.