UIImageView的折叠/卷曲边缘 [英] Fold/curl edge of UIImageView

查看:52
本文介绍了UIImageView的折叠/卷曲边缘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要折叠/展开UIImageView的边缘以将其标记为收藏夹.我搜索了多个站点,但未找到任何内容.

我附上了一些示例图像,并在可能的情况下附加了动画效果.

解决方案

做到这一点的一种方法是使用OpenGL动画化视图.有一个很好的库,名为 http: //mobiledevelopertips.com/cocoa/how-to-mask-an-image.html

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.

解决方案

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

这篇关于UIImageView的折叠/卷曲边缘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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