iOS curl up animation to remove uiimageview

穿精又带淫゛_ 提交于 2019-12-21 20:22:17

问题


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.

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?


回答1:


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

Edit: 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]; }];


来源:https://stackoverflow.com/questions/7331978/ios-curl-up-animation-to-remove-uiimageview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!