UIView的animateWithDuration在iOS8上没有动画 [英] UIView animateWithDuration not animating in ios8

查看:347
本文介绍了UIView的animateWithDuration在iOS8上没有动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实现了自定义SEGUE类模拟推不转型的导航栏。关键是要采取快照,将它们添加到视图,更换的viewController,移动快照,并最终将其删除。这emules的的viewController的水平运动,但实际上只有两个UIImagesView移动。

I have implemented a custom segue class for emulating the push transition without navigation bar. The trick is to take to snapshots, add them to the view, replace the viewController, move the snapshots, and finally remove them. This emules a horizontal movement of the viewController, but actually only two UIImagesView are moved.

以下code实现此。

self.destinationImageView.frame = offsetFrameD;
self.sourceImageView.frame = offsetFrameS;

//ViewController replacement
[self.sourceViewController presentModalViewController:self.destinationViewController animated:NO];

//Overpose the snapShot who will simulate the transition between vies.
[destinationView addSubview: self.sourceImageView];
[destinationView addSubview: self.destinationImageView];

[UIView animateWithDuration:1.0
                      delay:0.0
                    options:UIViewAnimationOptionCurveEaseOut
                 animations:^{
                     self.destinationImageView.frame = self.finalFrameD;
                     self.sourceImageView.frame = self.finalFrameS;
                 }
                 completion:^(BOOL finished) {
                     [self.sourceImageView removeFromSuperview];
                     [self.destinationImageView removeFromSuperview];
                 }];

这code与iOS 7的工作然而,使用的是iOS 8时,好像不进行动画。该destinationImageView和sourceImageView直接移动到finalPosition(无动画),并完成块不叫,所以两者的UIImageView都没有最终删除。

This code worked with iOS 7. However, when using iOS 8, it seems like the animation is not performed. The destinationImageView and sourceImageView are directly moved to the finalPosition (WITHOUT ANIMATING) and the completion block is not called, so both UIImageView are not finally removed.

有谁知道如何动画应该与iOS 8进行?

Does anyone knows how the animation should be performed with iOS 8?

推荐答案

您应该调整自动布局限制,而不是框架的位置。看看这个解决方案。我希望它能帮助。
<一href=\"http://stackoverflow.com/questions/25970457/uiview-transitionwithview-setting-the-frame-no-longer-works-ios8\">UIView transitionWithView&安培;设置框架不再工作iOS8上

You should adjust the auto layout constraints and not the frames position. Have a look at this solution. I hope it helps. UIView transitionWithView & setting the frame no longer works iOS8

这篇关于UIView的animateWithDuration在iOS8上没有动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆