Fold/curl edge of UIImageView

允我心安 提交于 2019-12-22 09:55:43

问题


I need to fold/unfold the edge of UIImageView to mark as a favorite. I searched across multiple sites, but have not found anything about it. I attached some example images, and, If possible, with animation effect.

Thanks!!


回答1:


One way to do it would be to animate the view usign OpenGL. There is a nice library for that called XBPageCurl

However, you could achieve a much lighter solution by creating a mask for the curl effect and animate your view while transitioning to it. Here is what it would look like

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];

UIImage *maskedImage = [yourImage imageMaskedWithImage:yourMask];
[yourImageView setImage:maskedImage];

[UIView commitAnimations];

To know how to mask an image, have a look here http://mobiledevelopertips.com/cocoa/how-to-mask-an-image.html




回答2:


can be done with UIViewController's presentModalViewController:animated: and setting the modalTransistionStyle to UIModalTransitionStylePartialCurl. See apple's docs.



来源:https://stackoverflow.com/questions/12496084/fold-curl-edge-of-uiimageview

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