iOS蜷缩动画以删除uiimageview [英] iOS curl up animation to remove uiimageview

查看:152
本文介绍了iOS蜷缩动画以删除uiimageview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要使用卷曲动画从我的应用中删除图像。我已经

i'm looking to remove an image from my app with a curl up animation. I've got

[UIView transitionWithView:sender.view.superview duration:1.5
options:UIViewAnimationOptionTransitionCurlUp                           
animations:^ { [sender.view removeFromSuperview]; }
completion:nil];

但这会卷曲整个页面,看起来好像下面有一个单独的页面,上面没有图像。

but this curls the entire page away and looks as though there's a separate page beneath without the image on it.

可以在不影响页面其他部分的情况下从页面卷曲图像而不是转换到新页面?我是否需要将imageview包装在容器视图中并将视图更改为转换?

Instead of a 'transition' to a new page is it possible to curl the image off the page without affecting the rest of the page? Do I need to wrap the imageview in a 'container view' and change transition with view to that?

推荐答案

您的视图参数是 sender.view.superview 表示您希望超级视图设置动画。只需删除超级视图部分。

Your view parameter is sender.view.superview which means you want the superview to animate. Just remove the superview part.

编辑:,对于要设置动画的内容,它必须是可动画的属性。从superview中删除视图与其属性无关。您可以将视图设置为0 alpha动画,并在完成该动画后将其从superview中删除,如下所示:

also, for something to animate, it must be animatable property. Removing a view from superview has nothing to do with it's properties. You could animate the view to 0 alpha and on completion of that animation remove it from superview like this:

[UIView transitionWithView:sender.view
                  duration:1.5
                   options:UIViewAnimationOptionTransitionCurlUp                           
                animations:^ { sender.view.alpha = 0; }
                completion:^ { [sender.view removeFromSuperview]; }];

这篇关于iOS蜷缩动画以删除uiimageview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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