自定义 UIImage 视图

Customizing the UIImage View

如何以编程方式更改位于 UIView 上并存在于 prototypeCell 中的图像视图的 borderWidth

我试过在界面生成器中更改 borderWidth,但它不起作用。1

期待更好的解决方案。2

你可以试试这样的

   @IBOutlet weak var imageView: UIImageView!
        // makes it circle if Width == Height
        imageView.layer.cornerRadius = imageView.frame.width / 2
        //Bordering
        imageView.layer.borderColor = UIColor.black.cgColor
        imageView.layer.borderWidth = 1