【发布时间】:2011-05-09 13:30:35
【问题描述】:
我有这个代码:
- (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
谢谢。
【问题讨论】:
标签: iphone objective-c xcode image