I'm sure this is simple but I am trying to add an array of images to a layer. Here is what I have so far:
// Create the fish layer
fishLayer = [CALayer layer];
//fish = [UIImageView imageNamed:@"Fish.png"];
fish.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"swim01.png"],
[UIImage imageNamed:@"swim02.png"],
[UIImage imageNamed:@"swim03.png"],
[UIImage imageNamed:@"swim04.png"],
[UIImage imageNamed:@"swim05.png"],
[UIImage imageNamed:@"swim06.png"],
[UIImage imageNamed:@"swim05.png"],
[UIImage imageNamed:@"swim04.png"],
[UIImage imageNamed:@"swim03.png"],
[UIImage imageNamed:@"swim02.png"], nil];
fish.animationDuration = 1.50;
fish.animationRepeatCount = -1;
[fish startAnimating];
//[self.view addSubview:fish];
//This should add the animated array to layer.
fishLayer.contents = fish;
fishLayer.bounds = CGRectMake(0, 0, 56, 56);
fishLayer.position = CGPointMake(self.view.bounds.size.height / 2,
self.view.bounds.size.width / 2);
[self.view.layer addSublayer:fishLayer];
There is no error but the array of images don't appear on the screen. I think maybe this line is the probem..
fishLayer.contents = fish;
I have added the imageview to my header files and added it in the XIB
Please help if you can,
Cheers,
Adam