【问题标题】:Customizing the UIImage View自定义 UIImage 视图
【发布时间】:2018-09-25 07:04:57
【问题描述】:

如何以编程方式更改位于 UIView 上并显示在原型单元中的图像视图的边框宽度

我已经尝试在界面生成器中更改边框宽度,但它不起作用。1

期待更好的解决方案。2

【问题讨论】:

  • 你的 imageView 的帧大小是多少?你能展示一下 UIImageView 的布局吗?

标签: swift4 android-custom-view custom-cell xcode10


【解决方案1】:

你可以试试这样的

   @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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-10-29
    • 2013-05-16
    • 2011-02-06
    • 2020-04-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多