2017-04-03 148 views

回答

0

从@垫,CLAASSEN

感谢GitHub上的回复

代码

- (void)viewDidLoad { 
    [[self tableView] registerClass:[UITableViewHeaderFooterView class] forHeaderFooterViewReuseIdentifier:@"headerFooterReuseIdentifier"]; 
} 

部首

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { 
    UITableViewHeaderFooterView *headerFooterView = [[self tableView] dequeueReusableHeaderFooterViewWithIdentifier:@"headerFooterReuseIdentifier"]; 
    headerFooterView.contentView.backgroundColor = kBackgroundColor; 

    return headerFooterView; 
} 

页脚

-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { 
    UITableViewHeaderFooterView *headerFooterView = [[self tableView] dequeueReusableHeaderFooterViewWithIdentifier:@"headerFooterReuseIdentifier"]; 
    headerFooterView.contentView.backgroundColor = kBackgroundColor; 

    return headerFooterView; 
} 
相关问题