Tag: nsuinteger

为什么NSInteger而不是NSUInteger在“numberOfSectionInTableView:”?

UITableView数据源方法numberOfSectionsInTableView:具有NSInteger的返回types。 但是,UITableView不能有负数的行; 它有0或更多的行,那么为什么NSInteger的返回types? 这不允许与返回的负整数有关的崩溃?

将NSUInteger添加到NSMutableArray

你好我正在一个项目上工作,我想添加一个NSUInteger到一个NSMutableArray。 一般来说,我是Objective-C和C的新手。 当我运行的应用程序NSLog显示空。 我会很感激任何人都可以提供帮助。 这是我的代码 -(NSMutableArray *)flipCardAtIndex:(NSUInteger)index { Card *card = [self cardAtIndex:index]; [self.flipCardIndexes addObject:index]; if(!card.isUnplayable) { if(!card.isFaceUp) { for(Card *otherCard in self.cards) { if(otherCard.isFaceUp && !otherCard.isUnplayable) { int matchScore = [card match:@[otherCard]]; if(matchScore) { otherCard.unplayable = YES; card.unplayable = YES; self.score += matchScore * MATCH_BONUS; } else { otherCard.faceUp = NO; self.score -=MISMATCH_PENALTY; } […]