Idaho Idaho - 2 months ago 234
iOS Question

Move From XCode 7 and Swift 2.2 to XCode 8 Swift 2.3 : frame size changed

I have an UIImageView with 2 constraints for height and width (120 & 120)

Here's the class of my image:

class RoundImageView: UIImageView{
override func awakeFromNib() {
super.awakeFromNib()
self.layer.cornerRadius = self.frame.size.width / 2
self.clipsToBounds = true
}
}


Since the update the size of my frame is 1000 x 1000 and not 120 x 120...

Any idea?

Answer

Use layoutSubviews instead of awakeFromNib