IOS 13 适配问题
升级IOS13后出现以下问题请各位大神帮看下如何解决,谢谢
错误信息:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableViewHeaderFooterView's contentView must remain a direct subview of it. Unexpected superview of the contentView: (null)'
代码:
//HeaderView的代理
- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
EquipmentHeaderView*headerView =nil;
if(tableView ==self.tableFoodView) {
headerView = [tableViewdequeueReusableHeaderFooterViewWithIdentifier:SectionViewID2];
[headerView.button addTarget:self action:@selector(tableFoodViewSetionDisplay:) forControlEvents:UIControlEventTouchUpInside];
if(self.socket.unDevArr>0) {
headerView.countLabel.text= [NSStringstringWithFormat:@"%ld/%ld",(long)self.socket.unDevArr.count,(long)self.socket.unDevArr.count];
}
headerView.titleName.text=GDLocalizedString(@"未添加设备");
}else{
headerView = [[EquipmentHeaderViewalloc]initWithReuseIdentifier:SectionViewID1];
[headerView.button addTarget:self action:@selector(tableViewSetion4Display:) forControlEvents:UIControlEventTouchUpInside];
DeviceMode*mode = [_arrDataSouceobjectAtIndex:section];
headerView.socket=self.socket;
[headerViewsetDeviceMode:mode];
}
if(headerView) {
headerView.button.tag=eHeaderTableView+section;
if(section ==seletedSetionIndex||(seletedSetionIndex==10&& tableView ==self.tableFoodView)) {
headerView.button.selected=YES;
headerView.imageView.transform=CGAffineTransformMakeRotation(M_PI*1);
}else{
headerView.button.selected=NO;
headerView.imageView.transform=CGAffineTransformMakeRotation(M_PI_2);
}
}
// return 0;
returnheaderView;
}