Headerview location of section in IOS TableView

Source: Internet
Author: User

As we all know, when the TableView style is plain, the header view of the section is set to have a card under navbar effect.

But when the properties of Tablview in the actual development are changed back to this

I thought I was going to get stuck with this thing, and then I looked at the hierarchical relationship of the view. The location of the section has changed, actually.

As long as it's here, okay?

In-(void) Scrollviewdidscroll: (Uiscrollview *) ScrollView;

    //This method is triggered when the scrollview is sliding, because UITableView inherits from Uiscrollview and therefore can also be called hereCGFloat Header = -;//This header is actually Section1 's header to the top of the distance    if(scrollview.contentoffset.y<=header&&scrollview.contentoffset.y>=0) {        //When the distance of the view slide is less than the headerScrollview.contentinset = Uiedgeinsetsmake ( -,0,0,0); }Else if(scrollview.contentoffset.y>header) {        //when the view sliding distance is greater than the header, here you can set the location of the header of the Section1, when set to take into account the navigation bar transparency on the impact of scrolling viewScrollview.contentinset = Uiedgeinsetsmake (header*0.5+103,0,0,0); }

The exact numeric position is calculated by itself.

Headerview location of section in IOS TableView

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.