iOS开发之UITableView+FDTemplateLayoutCell.h崩溃问题以及mjrefresh无法下拉刷新或刷新偏移问题

本文介绍了在iOS开发中遇到的两个常见问题:一是UITableView+FDTemplateLayoutCell在iOS10上使用时因未注册Cell导致的崩溃,解决方法是确保在设置tableFooterView前完成Cell的注册;二是MJRefresh下拉刷新失效或出现偏移20像素的问题,解决关键在于正确设置或检查系统默认的刷新头部偏移设置。
摘要由CSDN通过智能技术生成

1.<UITableView+FDTemplateLayoutCell.h>在iOS10上使用时会崩溃,崩溃时提示to uncaught exception ‘NSInternalInconsistencyException’, reason: 'Cell must be registered to table view for identifier - CircleCommentTableViewCell’
原因:
_tableView.tableFooterView = [[UIView alloc] init];
这句话写在注册cell之前,程序会crash,是因为你在设置表视图的tableFooterView的时候,他就会走tableView的数据源和代理方法,而这个时候你还没有注册cell,导致他认为你还没有注册cell,导致崩溃.所以只要把_tableView.tableFooterView = [[UIView alloc] init];放在注册之后即可哦,我给大家提个例子`- (UITableView *)tableView {

if (!_tableView) {
    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight-Base_NavbarHeight-Base_TabbarHeight) style:UITableViewStylePlain];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.showsHorizontalScrollIndicator = NO;
    _tableView.showsVerticalScrollIndicator = NO;
    _tableView.separatorStyl
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值