UICollectionView cellForRow崩溃

时间:2012-10-12 21:07:24

标签: nsindexpath uicollectionview uicollectionviewcell

您好我在UICollectionView的索引路径上获取自定义对象时遇到问题... 以下是我的代码。

我正在崩溃

[玩家firstName:]:unrecognized selector sent to instance

有什么建议吗?

 - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView     cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
BenchCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CollectionCell forIndexPath:indexPath];
[cell setFrame:CGRectMake(0, 4, 120, 50)];


    Player*homeBenchPlayer = [[self homeBench]objectAtIndex:indexPath.row];

    cell.playerName.text = homeBenchPlayer.firstName;
    cell.playerPosition .text = homeBenchPlayer.position;
    cell.playerPicture.image = [ UIImage imageWithData:homeBenchPlayer.picture];

return cell;

}

1 个答案:

答案 0 :(得分:0)

当我意外地收到此错误时,我通常会返回到IB,选择负责崩溃的对象,并调查Connections Inspector。通常问题似乎是错误的引用插座或发送事件。

这可能是由于调用performSelector:@selector(dismissModal:)来调用不存在的。{/ p>