IOS tabeview head View and tail view do not slide the implementation

Source: Internet
Author: User

Because the project needs can not let section in the Kinsoku view sliding, gu according to some information on the internet and their own arrangement of ideas, has achieved no sliding effect, on the code, what all said, engaged for 2 hours are tears ....

1. Create a TableView

_maintableview = [[UITableView alloc]initwithframe:cgrectmake (0,0, Kscreenwidth, Kscreenheight- -) Style:uitableviewstyleplain];//with navigation bar -64_maintableview.backgroundcolor =[Uicolor Clearcolor];_maintableview.datasource=Self;_maintableview.Delegate=Self;_maintableview.sectionheaderheight= +;//Headview High_maintableview.sectionfooterheight = -;//Footerview High_maintableview.contentinset = Uiedgeinsetsmake (0,0, - -,0);//need a bottom view when loading

2. Implement ScrollView Proxy Protocol

- (void) Scrollviewdidscroll: (Uiscrollview *) scrollview{cgfloat sectionheaderheight= -;//set maximum values for Headview and Footerview    if(scrollview.contentoffset.y<=sectionheaderheight&&scrollview.contentoffset.y>=0) {//Headerview just started the slideScrollview.contentinset = Uiedgeinsetsmake (-scrollview.contentoffset.y,0,-sectionheaderheight,0); }    Else if(Scrollview.contentoffset.y>=sectionheaderheight && Scrollview.contentoffset.y + -< Scrollview.contentsize.height-scrollview.frame.size.height) {//sliding in the middleScrollview.contentinset = Uiedgeinsetsmake (-sectionheaderheight,0,-sectionheaderheight,0); }Else if(Scrollview.contentoffset.y + ->= scrollview.contentsize.height-scrollview.frame.size.height && Scrollview.contentoffset.y < Scrollview.contentsize.height-scrollview.frame.size.height) {//Footerview at the end of the slideScrollview.contentinset = Uiedgeinsetsmake (0,0,-(SCROLLVIEW.CONTENTSIZE.HEIGHT-SCROLLVIEW.FRAME.SIZE.HEIGHT-SCROLLVIEW.CONTENTOFFSET.Y),0); }}

IOS tabeview head View and tail view do not slide the 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.