这是我收到的错误
2013-07-30 22:20:53.227 Matchismo[562:c07] Unknown class PlayingCardCollection in Interface Builder file.
2013-07-30 22:20:53.229 Matchismo[562:c07] -[UIView setSuit:]: unrecognized selector sent to instance 0x71433f0
2013-07-30 22:20:53.230 Matchismo[562:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setSuit:]: unrecognized selector sent to instance 0x71433f0'
我没有一个名为“PlayingCardCollection”的类,所以我看不到我怎么会收到这个错误,除非我命名错误,但我找不到这样的错误。
这是我的一些代码
- (Deck *) createDeck
{
return [[PlayingCardDeck alloc] init];
}
- (NSUInteger) startingCardCount
{
return 20;
}
- (void)updateCell:(UICollectionViewCell *) cell usingCard:(Card *) card
{
if ([cell isKindOfClass:[PlayingCardCollectionViewCell class]]) {
PlayingCardView* playingCardView = ((PlayingCardCollectionViewCell *)cell).playingCardView;
if ([card isKindOfClass:[PlayingCard class]]) {
PlayingCard *playingCard = (PlayingCard *)card;
playingCardView.rank = playingCard.rank;
playingCardView.suit = playingCard.suit;
playingCardView.faceUp = playingCard.faceUp;
playingCardView.alpha = playingCard.isUnplayable ? 0.3 : 1.0;
}
}
}
这是另一个文件的一部分。
- (NSInteger) numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
return 1;
}
- (NSInteger) collectionView:(UICollectionView *)collectionView
numberOfItemsInSection:(NSInteger)section
{
return self.startingCardCount;
}
- (UICollectionViewCell *) collectionView:(UICollectionView *)collectionView
cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell* cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"PlayingCard" forIndexPath:indexPath];
Card* card = [self.game cardAtIndex:indexPath.item];
[self updateCell:cell usingCard:card];
return cell;
}
如果需要更多代码,请告诉我。我有很多文件用于这个项目,但自从我的项目最后一次成功运行以来,大多数文件都没有被触及。提前致谢!