平時用header時,滑動時header會停留在頂端,那是設置的不對,想讓它跟著滑動,看下面的方法
//1.設成GroupUITableView *tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];//2.設置header,footer高度搞定- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ return 10;}- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ return 0.01;}group類型下,footer有默認高度,一定要設置高度后它才會不顯示。
還是用plain,但是設置footer的高度為10,header的高度為0.01(不社設也可以),這樣也不會停留的,親測可以。
新聞熱點
疑難解答