How to set image in circle in swift

前端 未结 14 1697
星月不相逢
星月不相逢 2020-12-04 09:55

How can i make i circle picture with swift ?

My ViewController :

import UIKit
import Foundation

class FriendsViewController : UIViewController{

            


        
相关标签:
14条回答
  • 2020-12-04 10:25

    For Swift3/Swift4 Developers:

    let radius = yourImageView.frame.width / 2
    yourImageView.layer.cornerRadius = radius
    yourImageView.layer.masksToBounds = true
    
    0 讨论(0)
  • 2020-12-04 10:25
    imageView.layer.cornerRadius = imageView.frame.height/2
    imageView.clipToBounds = true
    
    0 讨论(0)
提交回复
热议问题