为UIImage制作圆角

Abh*_*nav 2 iphone cocoa-touch uiimageview uiimage ios

在我的iPhone应用程序中,我必须显示一个UIImage,其四个角都是弯曲的,因此它在屏幕上看起来很好.但我的图像是一个矩形图像,由于来自第三方,因此无法在图像级别进行更改.

使用UIImageView我可以设置框架.使用代码,我如何修改我的UIImage有圆角?

任何线索?

Adi*_*mro 7

试试这种方式:

UIImageView *imageView = ...;
imageView.layer.cornerRadius = 7; // change this value  as per your desire
imageView.clipsToBounds = YES;
Run Code Online (Sandbox Code Playgroud)