ios – Cannot place UIImage by CGRect

0
69


I am attempting to construct a UIView of Social Media Person’s Profile and bought caught proper to start with – when including a Person Picture (UIImage) to my UIView. This is the code I am attempting to make use of:

import UIKit

class ProfileHeaderView: UIView {
    
    non-public lazy var profileImage: UIImageView = {
        let imageView = UIImageView(picture: UIImage(named: "hipsterCat"))
        
        // Making Picture Spherical
        imageView.layer.cornerRadius = imageView.body.measurement.width / 2
        imageView.clipsToBounds = true
        
        imageView.layer.borderColor = UIColor.white.cgColor
        imageView.layer.borderWidth = 3
                
        return imageView
    }()
    
    override init(body: CGRect) {
        tremendous.init(body: body)
        setupView()
    }
    
    required init?(coder aDecoder: NSCoder) {
        tremendous.init(coder: aDecoder)
        setupView()
    }
    
    non-public func setupView() {
        backgroundColor = .lightGray
        addSubview(profileImage)
    }
    
    override func layoutSubviews() {
        tremendous.layoutSubviews()
        
        profileImage.body = CGRect(
            x: bounds.midX - 64,
            y: bounds.midY - 64,
            width: 128,
            peak: 128
        )
    }
}

My job is to make use of CGRect to place UIImage on the superView, but as soon as I run the mission it simply would not seem on the display screen (solely gentle grey background is there).

UIImageView is all proper, the picture seems when commenting layoutSubviews() override however it’s not positioned.