Hello there,
I am working on a project for my third year of computer science, in which I have to build an app for the iPad to help primary school children with their welsh.
I have a dictionary that contains PNG images, of the weather in this case, as well as a string that relates to the image.
I am trying make it so that whenever the view is loaded from the menu, the images are shown on the screen at random. I could hard code it that a specific images appear on a specific UIImageView but that would result in the images being displayed in the same place every time.
My friend has helped me with the following code but it obviously doesn't do what I want it to do.
Any aid would be appreciated. I wasn't sure what else you need to know so give me a shot if you need any more information
EDIT: I'm aware that the title doesn't make any sense. I apologise in advance if you find it unclear/misleading in anyway.
I am working on a project for my third year of computer science, in which I have to build an app for the iPad to help primary school children with their welsh.
I have a dictionary that contains PNG images, of the weather in this case, as well as a string that relates to the image.
I am trying make it so that whenever the view is loaded from the menu, the images are shown on the screen at random. I could hard code it that a specific images appear on a specific UIImageView but that would result in the images being displayed in the same place every time.
My friend has helped me with the following code but it obviously doesn't do what I want it to do.
Code:
NSString *fileName = [[NSBundle mainBundle] pathForResource:@"Weather Plist" ofType:@"plist"];
weatherDictionary = [[NSMutableDictionary alloc] initWithContentsOfFile:fileName];
RecordIndex = arc4random()%[weatherDictionary count];
image1.image = [UIImage imageNamed:[[weatherDictionary valueForKey:@"Cloudy"] valueForKey:@"image"]];
//image2
//image3
//image4
Any aid would be appreciated. I wasn't sure what else you need to know so give me a shot if you need any more information
EDIT: I'm aware that the title doesn't make any sense. I apologise in advance if you find it unclear/misleading in anyway.