我有一个这样的if语句
@property (nonatomic) NSUInteger *theScore;
if (hint.hidden) {
theScore += (2);
} else {
theScore += (1);
}
NSLog(@"Score changed");
score.text = [NSString stringWithFormat:@"%d", theScore];但theScore不是增加2或1,而是增加8或4
有什么想法吗?
发布于 2012-07-07 22:17:15
因为它是指向整数的指针,而不是整数本身。4是整数的大小。
将其更改为NSUInteger theScore,不带*。
https://stackoverflow.com/questions/11375714
复制相似问题