Не переопределяйте loadView, переопределяйте viewDidLoad и добавляйте colorPicker self.view
Используйте SnapKit
colorPicker.snp.makeConstraints { (make) -> Void in
make.leading.trailing.bottom.equalTo(0)
make.top.equalTo(self.topLayoutGuide.snp.bottom);
}
Используйте iOS UIKit
colorPicker.translatesAutoresizingMaskIntoConstraints = false
var constraints = [NSLayoutConstraint(item: colorPicker, attribute: .leading, relatedBy: .equal, toItem: self.view, attribute: .leading, multiplier: 1, constant: 0),
NSLayoutConstraint(item: colorPicker, attribute: .bottom, relatedBy: .equal, toItem: self.view, attribute: .bottom, multiplier: 1, constant: 0),
NSLayoutConstraint(item: colorPicker, attribute: .trailing, relatedBy: .equal, toItem: self.view, attribute: .trailing, multiplier: 1, constant: 0)]
if #available(iOS 11.0, *) {
constraints.append(NSLayoutConstraint(item: colorPicker, attribute: .top, relatedBy: .equal, toItem: self.view.safeAreaLayoutGuide, attribute: .top, multiplier: 1, constant: 0))
} else {
constraints.append(NSLayoutConstraint(item: colorPicker, attribute: .top, relatedBy: .equal, toItem: self.topLayoutGuide, attribute: .bottom, multiplier: 1, constant: 0))
}
self.view.addConstraints(constraints)