First, Uitableviewstyleplain
1. Multi-period head stop (self-effect)
2. No intermediate spacing and head spacing (to be rewritten UITableViewCell \uitableviewheaderfooterview inside the Setframe method)
Extend: Leave the segment head without stopping (to remove the sticky effect)
-(void) Scrollviewdidscroll: (Uiscrollview *) ScrollView {
CGFloat sectionheaderheight = 30;
if (scrollview.contentoffset.y<=sectionheaderheight&&scrollview.contentoffset.y>=0) {
Scrollview.contentinset = Uiedgeinsetsmake (-scrollview.contentoffset.y, 0, 0, 0);
} else if (scrollview.contentoffset.y>=sectionheaderheight) {
Scrollview.contentinset = Uiedgeinsetsmake (-sectionheaderheight, 0, 0, 0);
}
}
Second, Uitableviewstylegroup
Note: Remove the head and middle interval
The right way to understand
1. Set the height of the header is a special small value (can not be zero zero if the Apple will take the default value will not eliminate the head spacing)
UIView *view = [[UIView alloc]initwithframe:cgrectmake (0, 0, self.view.frame.size.width, 0.001)];
View.backgroundcolor = [Uicolor Redcolor];
Self.tableView.tableHeaderView = view;
2. Write Agent method (the middle of the white is actually the height of the end of the role of the agent set the end of the height of the return value can not be 0)
-(CGFloat) TableView: (UITableView *) TableView heightforfooterinsection: (nsinteger) Section
{
return 0.01f;
}
This effect can also be achieved by special processing methods
1. Self.tableView.contentInset = Uiedgeinsetsmake (-44, 0, 0, 0);
2. Rewrite the Uitableviewheaderfooterview
-(void) Setframe: (CGRect) frame{
frame.size.height+=10;
[Super Setframe:frame];
}
Uitableviewstyleplain vs. Uitableviewstylegroup styles