0
我确定这很简单,但我试图将图像数组添加到图层。这是我到目前为止:将图像视图添加到图层
// 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];
没有错误,但图像数组不出现在屏幕上。我想,也许这条线是probem ..
fishLayer.contents = fish;
我已经加入了ImageView的到我的头文件,并在厦门国际银行增加其
如果可以请帮帮忙,
干杯,
亚当