【问题标题】:[UITableViewCell otherFeeLblName]: unrecognized selector sent to instance 0x7fc45009a000[UITableViewCell otherFeeLblName]:无法识别的选择器发送到实例 0x7fc45009a000
【发布时间】:2019-05-29 12:08:04
【问题描述】:

我已将UITableViewController 与静态单元格一起使用,在这两个部分中我有动态 xib 单元格。它在所有 iOS 手机设备中都可以正常工作,但在 iPad 中它会崩溃。

[UITableViewCell otherFeeLblName]: 无法识别的选择器发送到 实例 0x7fc45009a000

    if (indexPath.section == 2 && defaultsOtherFees.count>0 && (flatRateStatus !=YES)) {  OtherFeeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"OtherFeeCell"];
    NSDictionary *otherFeeDict = defaultsOtherFees[indexPath.row];

    if (otherFeeDict.count>indexPath.row) {

        NSString *otherPriceDescription = [otherFeeDict objectForKey:@"otherPriceDescription"];
        cell.otherFeeLblName.text = otherPriceDescription; //crashes on ipad


        cell.delegate = self;


    }

    return cell;
}

if (indexPath.section == 4) {

    RemarkCell *cell = [tableView dequeueReusableCellWithIdentifier:@"RemarkCell"];
    NSDictionary *dict = remarksArray[indexPath.row];

    return cell;
}else
{
    return [super tableView:tableView cellForRowAtIndexPath:indexPath];
} 

【问题讨论】:

  • 请输入你所做的一些代码。
  • @ChitraKhatri 这是用 cellForRow 编写的代码

标签: ios objective-c uitableview


【解决方案1】:

声明自定义类是不够的,你必须强制转换它

OtherFeeCell *cell = (OtherFeeCell *)[tableView dequeueReusableCellWithIdentifier:@"OtherFeeCell"];

【讨论】:

  • 那么自定义单元格的类在Interface Builder中没有正确设置。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-05-14
  • 1970-01-01
  • 1970-01-01
  • 2019-08-28
  • 2012-07-24
相关资源
最近更新 更多