繁体   English   中英

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

[英]UIView's animations stopped when adding a subview

这是我使用情节提要创建的视图:

在此处输入图片说明

云,头像图像按钮和其他文本按钮等是其子视图。 在其viewDidAppear方法中,我添加了几种动画方法,这些方法使云层水平“浮动”,例如:

[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];

在此处输入图片说明

问题:当我这样做时,所有云都停止动画(而过渡仍然有效)。

有任何想法吗? 谢谢。

几个小时后,我的头撞到墙上,看来这是一个iOS模拟器错误。 在设备上一切正常。

注意任何面临相同问题的人:

操作系统:Mavericks 10.9.4

Xcode:5.1.1

iOS模拟器目标:iOS 7.1

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM