My picture for user profile looks fine (a circle) on older versions, but it looks like an oval on my friend's XR phone. I am not sure why. Below are pics of the storyboard constraints and my code for the constraints.
Oval Shaped Profile Pic Storyboard constraints
@IBOutlet weak var profileButton: UIButton!var profile: Profile?
var imagePicker: UIImagePickerController!
var setImage = false
override func viewDidLoad() {
super.viewDidLoad()
profileButton.layer.cornerRadius = 0.5 * profileButton.bounds.size.width
profileButton.clipsToBounds = true
ProfileService.show { [weak self] (profile) in
self?.profile = profile
//display profile image and remove ninja default image
if let imageURL = URL(string: (profile?.imageURL ?? "")) {
if self?.setImage == false {
DispatchQueue.main.async {
self?.profileButton.setImage(nil, for: .normal)
self?.profileButton.kf.setBackgroundImage(with: imageURL, for: .normal)
self?.profileButton.layer.borderWidth = 0.5
self?.profileButton.layer.borderColor = UIColor.lightGray.cgColor
}
}
}else{
let image = UIImage(named: "ninja")
self?.profileButton.setImage(image, for: .normal)
}...
}
}