пользовательское представление не хочет загружать в переопределении loadView - PullRequest
0 голосов
/ 10 апреля 2020

Я хочу спросить, почему мой пользовательский вид не отображается в viewController в override loadView (). это просто чистый белый, что-то не так в моей настройке? Здесь я покажу вам мои настройки

// This is inside my custom UIView
lazy var contentViewSize = CGSize(width: self.frame.width, height: self.frame.height + 100)

    lazy var scrollView: UIScrollView = {
        let scrollView = UIScrollView(frame: .zero)
        scrollView.frame = self.bounds
        scrollView.contentSize = contentViewSize
        scrollView.backgroundColor = .white
        return scrollView
    }()

    lazy var contentView: UIView = {
        let view = UIView()
        view.frame.size = contentViewSize
        view.backgroundColor = #colorLiteral(red: 0.9560143352, green: 0.9656195045, blue: 0.9688490033, alpha: 1)
        return view
    }()

    let navigationView      = UIView(color: .white)
    let profileImage        = UIImageView(image: #imageLiteral(resourceName: "ic-tab-profile"), renderingMode: .alwaysTemplate)
    let profileLbl          = GProfileLbl(name: "Profile Name".localized(), fontSize: 27, color: #colorLiteral(red: 0.2, green: 0.2, blue: 0.2, alpha: 1))
    let schoolSelectionBtn  = GTSelecSchoolBtn(type: .system)
    let progressView        = ProgressView()
    let infoBtn             = GTProfileBtn(name: "Basic Info")
    let changePasswordBtn   = GTProfileBtn(name: "Change Password")
    let helpBtn             = GTProfileBtn(name: "Help")
    let termAndConditionBtn = GTProfileBtn(name: "Term and conditions")
    let privacyBtn          = GTProfileBtn(name: "Privacy")
    let signOutBtn: UIButton = {
        let btn = UIButton(type: .system)
        let attributeString = NSAttributedString(string: "Sign Out", attributes: [NSAttributedString.Key.foregroundColor: #colorLiteral(red: 0.9215686275, green: 0.3411764706, blue: 0.3411764706, alpha: 1), NSAttributedString.Key.font: UIFont(name: "NunitoSans-SemiBold", size: 14)])
        btn.setAttributedTitle(attributeString, for: .normal)
        return btn
    }()

    let progressHUD = JGProgressHUD(style: .dark)

    var infos: InfoResult?
    var schools  = [SchoolList]()
    var progress: ProgressStatus?

    override init(frame: CGRect) {
        super.init(frame: .zero)
        backgroundColor = .white
        setupScrollView()
        configure()
    }

    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

// this is in my UIViewController
lazy private(set) var profileView = ProfileView()

    override func loadView() {
        view = profileView
    }

    override func viewDidLoad() {
        super.viewDidLoad()        
        setupNavigation()
    }

Можете ли вы сказать мне, где мой вид не загружен? Я использую автоматическое расположение в моем лейбле, из-за этого?

...