0

私はこのような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 ずつ増加しています。

何か案は?

4

1 に答える 1

4

整数自体ではなく、整数へのポインタであるためです。4 は整数のサイズです。

* なしで NSUInteger theScore に変更します。

于 2012-07-07T14:17:15.403 に答える