I have a UIImageView on each of my UITableView cells, that display a remote image (using SDWebImage). I\'ve done some QuartzCore
In Swift use this Extension for CircularImageView or RoundedImageView :
extension UIView {
func circular(borderWidth: CGFloat = 0, borderColor: UIColor = UIColor.whiteColor()) {
let radius = CGRectGetWidth(self.bounds) / 2
self.layer.cornerRadius = radius
self.layer.masksToBounds = true
self.layer.borderWidth = borderWidth
self.layer.borderColor = borderColor.CGColor
}
func roundedCorner(borderWidth: CGFloat = 0, borderColor: UIColor = UIColor.whiteColor()) {
let radius = CGRectGetWidth(self.bounds) / 2
self.layer.cornerRadius = radius / 5
self.layer.masksToBounds = true
self.layer.borderWidth = borderWidth
self.layer.borderColor = borderColor.CGColor
}
}
Usage:
self.ImageView.circular()
self.ImageView.roundedCorner()