Trying to change image using int
I have this code:
- (IBAction)next {
static int index = 0; // <-- here
index++;
// Set imageCount to as many images as are available
int imageCount=16;
if (index<=imageCount) {
NSString* imageName=[NSString stringWithFormat:@"img%i", index];
[picture setImage: [UIImage imageNamed: imageName]];
}
}
and it is supposed to change the i开发者_JS百科mage on the imageview picture but it just changes the imageview to a white background and all my images are named img1 img2 img3 etc how do I make this work?
Please help.
Will
All I forget was the .jpg on the end of stringWithFormat:@"img%i" ;) Haha
精彩评论