Objective C - XCode not recognizing variable outside of if statement
问题 Trying to set a sprite filename with an if statement, then load the proper file based on that string. It looks like there's a problem with my variable scope, but I don't know what it is. Here's my code: if ([[GameManager sharedGameManager] newHighScore] == TRUE) { NSString *highScoreLabelText = @"label-new-high-score.png" } else { NSString *highScoreLabelText = @"label-high-score.png" } CCSprite *highScoreLabel = [CCSprite spriteWithSpriteFrameName:highScoreLabelText]; [highScoreLabel