且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在swift中设置图像

更新时间:2022-12-05 23:31:40

import UIKit

class ViewController: UIViewController {
  @IBOutlet weak var image: UIImageView!

  override func viewDidLoad() {
    super.viewDidLoad()

    image.layer.borderWidth = 1
    image.layer.masksToBounds = false
    image.layer.borderColor = UIColor.blackColor().CGColor
    image.layer.cornerRadius = image.frame.height/2
    image.clipsToBounds = true
}

这就是你所需要的......

That is all you need....