不管是oc还是swift这种方式都可以。
let userPic = UIImageView(frame: CGRect(x: 0, y: 0, 200, height: 200))
userPic.layer.cornerRadius = userPic.frame.size.width / 2
userPic.layer.masksToBounds = true