2019-10-14

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;

}

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容