0
我有這樣的代碼:去下一個圖像和以前的圖像
- (IBAction)next {
// <-- here
index++;
// Set imageCount to as many images as are available
int imageCount=3;
if (index<=imageCount) {
NSString* imageName=[NSString stringWithFormat:@"img%i.jpg", index];
[picture setImage: [UIImage imageNamed: imageName]];
}
}
- (IBAction)prev {
// <-- here
index--;
// Set imageCount to as many images as are available
int imageCount=3;
if (index > 1) {
NSString* imageName=[NSString stringWithFormat:@"img%i.jpg", index];
[picture setImage: [UIImage imageNamed: imageName]];
}
}
第一個鏈接到一個按鈕,工作正常,並向前改變圖像。第二個鏈接到另一個按鈕,但只會倒退一個圖像。我真的陷入困境,我需要嚴厲的幫助。請有人可以幫助我。 (索引是一個屬性併合成)ImageCount不是。也沒有圖像列表。 圖像是: img1.jpg img2.jpg img3.jpg
感謝。
非常感謝。 – 2010-11-13 15:38:15