【发布时间】:2014-08-02 09:47:41
【问题描述】:
我正在尝试设置一个按钮,在作为我的根视图控制器的一部分的图像视图中播放动画,然后继续更改子视图控制器。
但由于某种原因,代码更改了视图控制器,然后播放动画。
我认为动画片段将在视图控制器更改发生之前实现,因为它是代码中的第一个。
代码做的一切都很好,它只是向后做。有人知道出了什么问题吗?
- (IBAction)next:(UIButton *)sender {
clouds.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"cloudAnim.0001.png"],
[UIImage imageNamed:@"cloudAnim.0002.png"],
[UIImage imageNamed:@"cloudAnim.0003.png"],
[UIImage imageNamed:@"cloudAnim.0004.png"],
[UIImage imageNamed:@"cloudAnim.0005.png"],
[UIImage imageNamed:@"cloudAnim.0006.png"],
[UIImage imageNamed:@"cloudAnim.0007.png"],
[UIImage imageNamed:@"cloudAnim.0008.png"],
[UIImage imageNamed:@"cloudAnim.0009.png"],
[UIImage imageNamed:@"cloudAnim.0010.png"],
[UIImage imageNamed:@"cloudAnim.0011.png"],
[UIImage imageNamed:@"cloudAnim.0012.png"],
[UIImage imageNamed:@"cloudAnim.0013.png"],
[UIImage imageNamed:@"cloudAnim.0014.png"],
[UIImage imageNamed:@"cloudAnim.0015.png"],
[UIImage imageNamed:@"cloudAnim.0016.png"],
[UIImage imageNamed:@"cloudAnim.0017.png"],
[UIImage imageNamed:@"cloudAnim.0018.png"],
[UIImage imageNamed:@"cloudAnim.0019.png"],
[UIImage imageNamed:@"cloudAnim.0020.png"],
[UIImage imageNamed:@"cloudAnim.0021.png"],
[UIImage imageNamed:@"cloudAnim.0022.png"],
[UIImage imageNamed:@"cloudAnim.0023.png"],
[UIImage imageNamed:@"cloudAnim.0024.png"],
[UIImage imageNamed:@"cloudAnim.0025.png"],
[UIImage imageNamed:@"cloudAnim.0026.png"],
[UIImage imageNamed:@"cloudAnim.0027.png"],
[UIImage imageNamed:@"cloudAnim.0028.png"],
[UIImage imageNamed:@"cloudAnim.0029.png"],
[UIImage imageNamed:@"cloudAnim.0030.png"],
[UIImage imageNamed:@"cloudAnim.0031.png"],
[UIImage imageNamed:@"cloudAnim.0032.png"],
[UIImage imageNamed:@"cloudAnim.0033.png"],
[UIImage imageNamed:@"cloudAnim.0034.png"],
[UIImage imageNamed:@"cloudAnim.0035.png"],
[UIImage imageNamed:@"cloudAnim.0036.png"],
[UIImage imageNamed:@"cloudAnim.0037.png"],
[UIImage imageNamed:@"cloudAnim.0038.png"],
[UIImage imageNamed:@"cloudAnim.0039.png"],
[UIImage imageNamed:@"cloudAnim.0040.png"],
[UIImage imageNamed:@"cloudAnim.0041.png"],
[UIImage imageNamed:@"cloudAnim.0042.png"],
[UIImage imageNamed:@"cloudAnim.0043.png"],
[UIImage imageNamed:@"cloudAnim.0044.png"],
[UIImage imageNamed:@"cloudAnim.0045.png"],
[UIImage imageNamed:@"cloudAnim.0046.png"],
[UIImage imageNamed:@"cloudAnim.0047.png"],
[UIImage imageNamed:@"cloudAnim.0048.png"], nil];
[clouds setAnimationRepeatCount:1];
clouds.animationDuration = 2.0;
[clouds startAnimating];
if (currentPage == 1){
self.page02ViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"page02"];
[self.view insertSubview:_page02ViewController.view atIndex:0];
[self.page01ViewController.view removeFromSuperview];
}
if (currentPage == 2){
self.page03ViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"page03"];
[self.page02ViewController.view removeFromSuperview];
[self.view insertSubview:_page03ViewController.view atIndex:0];
}
currentPage = currentPage +1;
if (currentPage >3){
currentPage = 3;
}
}
【问题讨论】:
标签: ios uiviewcontroller uiimageview uibutton