Friday, June 10, 2011

Converting NSString to int and Vice Versa

int to NSString

The following example displays an integer's value as a text label:
currentScoreLabel.text = [NSString stringWithFormat:@"%d", currentScore];


NSString to int

The following example displays a text value as a integer:
int currentScore=[currentScoreLabel.text intValue];

1 comment:

Followers