2010-08-01 94 views
0

我有这样的代码来改变形象:尝试使用INT

- (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]]; 
    } 
} 

并且它应该改变对imageview的画面图像,但它只是改变了ImageView的一个白色的背景和我的所有图像被命名为IMG1 img2 img3等我如何使这项工作?

请帮忙。

请问

回答

0

所有我忘了是在stringWithFormat结束的.JPG:@ “IMG%I”)哈哈