Search code examples
iosobjective-cunrecognized-selector

Animated image from plist


I'm trying to load a value from my plist which is the base name of the animated image I want to create. Essentially, I want my plist to contain the name image-.jpg, and use the code to do the rest.

I've gotten the idea from here Display animated GIF in iOS

and now I'm just trying to mix a plist into play. So far I've gotten this:

imageName.image = [UIImage animatedImageNamed:[[myArray objectAtIndex:indexValue] valueForKey:@"imageName" duration:1.0f]];

The valueForKey is image-.jpg, so when iOS runs animatedImageNamed it would be image-1.jpg, image-2.jpg, etc.

My issue is that Xcode displays an error at animatedImageNamed, saying there's no known method for selector.

How can I fix this?


Solution

  • I think the issue is with the placement of ']' :) May be the statement should look like

    imageName.image = [UIImage animatedImageNamed:[[myArray objectAtIndex:indexValue] valueForKey:@"imageName"] duration:1.0f]