相关疑难解决方法(0)

在iOS5中的UITableView中出现dequeueReusableCellWithIdentifier错误

我在iOS 5中收到此错误

-[UITableView dequeueReusableCellWithIdentifier:forIndexPath:]: unrecognized selector sent to instance 0xa217200

但是,我在iOS 6中没有错误.我该如何解决这个问题?这是我的代码:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"MyCell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; /// SIGABRT error

    if (!cell)
    {
        cell = [[UITableViewCell alloc]
        initWithStyle: UITableViewCellStyleSubtitle
        reuseIdentifier: CellIdentifier];
    }

    return cell;
}
Run Code Online (Sandbox Code Playgroud)

uitableview ios ios5 ios6

49
推荐指数
2
解决办法
2万
查看次数

标签 统计

ios ×1

ios5 ×1

ios6 ×1

uitableview ×1