自定义表视图节头报错

使用storyboard 自定义uitableView节头报错:

AX ERROR: Could not find my mock parent, most likely I am stale

代码:

 - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    static NSString *cellID = @"sectionHeaderID";
    UITableViewCell *headerview = [tableView dequeueReusableCellWithIdentifier:cellID];
    return headerview;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section

这是个uitableview的代理方法 ,要求返回的是一个继承自UIView的对象. 而你返回了一个UITableviewcell,不知所云的作法.

首先要明白这个代理方法是干什么的.如果你的uitableview style为group 它才会起作用.它允许用户自定义表头.