我有一个UIImageView *picture
更改图像使用按钮iPhone
和UIButton *next
和
- (IBAction)next {
}
我想改变的观点,但只有当图像等于图像...例如img1
但使用相同的按钮我想也能够改变图片,如果图像= img2,但不同的图像(img3)
到目前为止,我有这样的代码,但它给我的错误:
- (IBAction)next {
if (picture UIImage = imageNamed:@"img01.jpg") {
[picture setImage: [UIImage imageNamed:@"img02.jpg"
}
if (picture UIImage = imageNamed:@"img02.jpg") {
[picture setImage: [UIImage imageNamed:@"img03.jpg"
}
}
除非你有迫切的需求,否则你不应该使用静态变量。你现在没有办法获得图像索引。 – mvds 2010-08-01 13:13:03