iOS:创建带有圆角的UIImage或UIImageView [英] IOS: create a UIImage or UIImageView with rounded corners
本文介绍了iOS:创建带有圆角的UIImage或UIImageView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以创建带有圆角的UIImage
或UIImageView
?因为我想拿一个UIImage
并显示在UIImageView
里面,但是我不知道该怎么做.
Is it possible create an UIImage
or an UIImageView
with rounded corners? Because I want take an UIImage
and show it inside an UIImageView
, but I don't know how to do it.
推荐答案
是的,有可能.
导入QuartzCore
(#import <QuartzCore/QuartzCore.h>
)标头并使用UIImageView
的layer
属性播放.
Yes, it is possible.
Import the QuartzCore
(#import <QuartzCore/QuartzCore.h>
) header and play with the layer
property of the UIImageView
.
yourImageView.layer.cornerRadius = yourRadius;
yourImageView.clipsToBounds = YES;
请参见 CALayer 类参考以获取更多信息.
See the CALayer class reference for more info.
这篇关于iOS:创建带有圆角的UIImage或UIImageView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文