I've created a UIImage that changes image every 8 seconds, however right now its made so that the images are hard coded in a specific order, my question is how can I untiles the arc 4 random tool or another way to make it so that the order is completely random, here is my code as is:
My .h:
#import <UIKit/UIKit.h>
@interface HomeViewController : UIViewController {
NSTimer *myTimer;
IBOutlet UIImageView *imageview;
}
@end
And in my .m:
- (void)viewDidLoad
{
[super viewDidLoad];
myTimer = [NSTimer scheduledTimerWithTimeInterval:8.00 target:self selector:@selector(changeImage) userInfo:nil repeats:YES];
_images = @[@"Background 2.png", @"Background 3.png", @"Background 4.png", @"Background 5.png", @"Background 6.png", @"Background 7.png", @"Background 9.png", @"RSGC Crest.png"];
}
- (void)changeImage
{
static int counter = 0;
if([_images count] == counter+1)
{
counter = 0;
}
imageview.image = [UIImage imageNamed:[_images objectAtIndex:counter]];
counter++;
}
Any help would be hugely appreciated.