在我的iPhone应用程序中,我必须显示一个UIImage,该UIImage的所有四个角都弯曲,以使其在屏幕上看起来不错。但是我的图像是矩形图像,由于它来自第三方,因此无法在图像级别进行更改。
使用UIImageView可以设置框架。使用代码,如何修改UIImage使其具有圆角?
有什么线索吗?
最佳答案
尝试这种方式:
UIImageView *imageView = ...;
imageView.layer.cornerRadius = 7; // change this value as per your desire
imageView.clipsToBounds = YES;