Hey
I'm having a problem with a string creation and comparison that seems to lose it's contents. Currently I have this:
switch (creditPos)
{
case 0:
[creditCart.faceImage setImage:[NSString stringWithFormat:@"%@credits_face1.png", _director.platformPrefix]];
break;
case 1:
[creditCart.faceImage setImage:[NSString stringWithFormat:@"%@credits_face2.png", _director.platformPrefix]];
break;
case 2:
[creditCart.faceImage setImage:[NSString stringWithFormat:@"%@credits_face3.png", _director.platformPrefix]];
break;
case 3:
[creditCart.faceImage setImage:[NSString stringWithFormat:@"%@credits_face4.png", _director.platformPrefix]];
break;
case 4:
[creditCart.faceImage setImage:[NSString stringWithFormat:@"%@credits_face5.png", _director.platformPrefix]];
break;
default:
break;
}
faceImage is an object I've created and inside the function for setImage I have...
- (void)setImage:(NSString *)inImageName {
NSLog(@"Before Break");
// By default set the scale to 1.0f and the filtering to GL_NEAREST
if(![imageName isEqualToString:inImageName])
{
NSLog(@"Hit");}
The problem I'm having is that when I pass in the string using the NSString stringWithFormat, it will work perhaps 5-8 times before somehow bugging up and sending something completely random instead to the function such as -36.657.
How is this possible? Nothing in the parameters is changing as _director.platformPrefix is set at the start of the program and never altered. The only thing which changes is creditPos to select with string to create + pass to the function. Somehow the string being created is just gibberish after some iterations and trying to compare it to the last string passed in crashes the code without any error thrown back.
Help :(