ios - 未设置 Imageview 角半径

标签 ios swift

我在界面生成器中创建了一个 imageView,然后在我的 UITableViewCell 子类中设置了圆角半径。不过好像不适用?图片已设置但没有圆角半径?

在 awakeFromNib 中

homeBackground?.image = UIImage(named: "score.png")
homeBackground?.layer.masksToBounds = true
homeBackground?.clipsToBounds = true
homeBackground?.layer.cornerRadius = 25

最佳答案

不要忘记将 UIImageViewclipSubviews 属性设置为 YES。

enter image description here

关于ios - 未设置 Imageview 角半径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34476513/

相关文章:

iOS - 测量距离的最佳方式

android - 具有 native 代码支持的跨平台移动框架

ios - Swift 字谜检查器

ios - 如何正确使用 prepare for segue for Structs?

ios - Swift - 将带有 AttributedString 的 URL 添加到 UITextView

ios - 如何在显示 View 时屏蔽 ViewController

ios - 无法在 vscode 的 iOS 模拟器中启动应用程序

ios - URLSessionDownloadDelegate didFinishDownloadingTo 未在后台调用

ios - 如何使用不在我的帐户中的配置文件来分发应用程序?

objective-c - swift 3 : Stop it from converting [NSString] to [String]