iOS curl up animation to remove 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.
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?
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]; }];
精彩评论