2010-08-01 37 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」)哈哈