添加子视图时,UIView的动画停止了

时间:2014-09-17 02:55:24

标签: ios core-animation

以下是我使用Storyboard创建的视图:

enter image description here

云,头像图像按钮和其他文本按钮等是其子视图。在它的viewDidAppear方法中,我添加了几种动画方法,这些方法可以使云“浮动”#34;横向,例如:

[UIView animateWithDuration:4.0f
                          delay:0.0f
                        options:(UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat | UIViewAnimationOptionAllowUserInteraction)
                     animations:^{
                         _cloud1.frame = its new frame so that it looks to float horizontally;
                     }
                     completion:nil];

现在我有另一个使用XIB文件创建的子视图。它基本上是一个自定义大小的子视图,当点击头像图像按钮时会出现(我们可以将其视为"编辑个人资料屏幕"在社交应用中)。我添加了这个动画块(请注意它只是出现在紫色圆圈的顶部,实际上没有删除):

_editProfileViewController = [[EditProfileViewController alloc] initWithNibName:nil bundle:nil];
[self addChildViewController:_editProfileViewController];
[_editProfileViewController didMoveToParentViewController:self];

[UIView transitionWithView:self.view duration:0.3 options:(UIViewAnimationOptionTransitionCrossDissolve) animations:^
{
    [self.view addSubview:_editProfileViewController.view];

} completion:NULL];

enter image description here

问题:当我这样做时,所有云停止动画(转换仍然有效)。

有什么想法吗?谢谢。

1 个答案:

答案 0 :(得分:0)

几个小时后,我的头靠在墙上,似乎这是一个iOS模拟器错误。设备上的一切正常。

注意遇到同样问题的人:

  操作系统:小牛10.9.4

     

Xcode:5.1.1

     

iOS模拟器目标:iOS 7.1

相关问题