When setting the image for a button, I use stringWithFormat: like so:
[buttonImage setImage:[ImgUtil image:[NSString stringWithFormat:@"myImage_%d.png", selectNum + 1 ]] ];
I want to inspect that string. I thought maybe I could get the name back from the button:
if (buttonImage.image == [UIImage imageNamed:@"myImage_2.png"]) {
NSLog(@"the name of the buttonImage is %@", buttonImage.image);
}
but that doesn’t work. How can I look at that string?
If what you want is to “test what the “myImage_%d.png” ends up being” in the following line:
Then I would suggest that you reformat and simplify your code. It will give you the additional advantage of making it easier to read: