Cut a UIImage into a circle

后端 未结 11 2288
面向向阳花
面向向阳花 2020-11-27 13:30

I want to cut a UIImage into a circle so that I can then use it as an annotation. Every answer on this site that I\'ve found describes creating an UIImage

11条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-27 14:08

    All these answers were really complex for a straight forward solution. I just replicated my Objective-C code and adjusted for Swift.

    self.myImageView?.layer.cornerRadius = (self.myImageView?.frame.size.width)! / 2;
    self.myImageView?.clipsToBounds = true
    

提交回复
热议问题