I\'m aware that the formulae frame.size.width/2 should produce a circle border, however in XCode I am currently experiencing some discrepancies.
I have
The problem is that when the circle is applied, the bounds of the view are still considered the default (320x480) and so if you have set constraints related to the screen, the image will be bigger on iPhone 6/6+ for instance.
There are various solution, but if you want a fast one, just put your code:
imgAvatar.layer.cornerRadius = imgFrame.frame.size.width/2
in - viewDidLayoutSubviews in your view controller or in - layoutSubviews in your view, checking before if the cornerRadius is different from the width/2 of the image's frame. Something like this:
if (imgAvatar.layer.cornerRadius != imgFrame.frame.size.width/2) {
imgAvatar.layer.cornerRadius = imgFrame.frame.size.width/2
}