1

当我在单个视图中运行两个 UIImageview 动画时,第一个图像与第二个图像重叠,但我已经安排第二个图像在 IB 中的第一个图像之上。为什么?请指教

 duckview2.animationImages = [NSArray arrayWithObjects:
                            [UIImage imageNamed:@"duck1.png"],
                            [UIImage imageNamed:@"duck2.png"],
                            [UIImage imageNamed:@"duck3.png"],
                            [UIImage imageNamed:@"duck4.png"],                              
                            [UIImage imageNamed:@"duck5.png"],nil]; 
duckview2.animationDuration = 0.3;
duckview2.animationRepeatCount = -1;
[duckview2 startAnimating];
[self.view addSubview:duckview2];


cowview2.animationImages = [NSArray arrayWithObjects:
                           [UIImage imageNamed:@"cow1b.png"],
                           [UIImage imageNamed:@"cow2b.png"],
                           [UIImage imageNamed:@"cow3b.png"],
                           [UIImage imageNamed:@"cow4b.png"],nil]; 
cowview2.animationDuration = 2;
cowview2.animationRepeatCount = -1;
[cowview2 startAnimating];
[UIView setAnimationBeginsFromCurrentState:YES];
[self.view addSubview:cowview2];
4

0 回答 0