我将如何创建一个随机图像生成器,它不会重复图像,直到它通过它们一次?
例如:
-(IBAction)随机图像按钮 {
int randomimages = rand() % 5;
switch (randomimages) {
case 0:
imageview.image = [UIImage imageNamed:@"IMAGE_001.png"];
break;
case 1:
imageview.image = [UIImage imageNamed:@"IMAGE_002.png"];
break;
case 2:
imageview.image = [UIImage imageNamed:@"IMAGE_003.png"];
break;
case 3:
imageview.image = [UIImage imageNamed:@"IMAGE_004.png"];
break;
case 4:
imageview.image = [UIImage imageNamed:@"IMAGE_005.png"];
break;
default:
break;
}
如果图像按以下顺序出现:1,4,2,5,4,3 我如何确保在显示所有 5 张图像之前不会再次出现“4”?
谢谢你的帮助!