Я пытаюсь добавить флажки (представления библиотеки) к представлению контейнера. Но они не появляются.
@IBOutlet weak var checkBoxesContainerView: UIView! //this is view where I', trying to add checkboxes
func initialize() {
let optionsList = webFormElement.possibleValues
var latestCheckBox: Checkbox? = nil
for option in optionsList {
var checkBox = Checkbox(frame: CGRect(x: 0, y: 0, width: 20, height: 20)) //creating checkbox programmatically - it's custom view, but it's works in another places
checkBox.borderLineWidth = 1
checkBox.uncheckedBorderColor = UIColor.black
checkBoxesContainerView.addSubview(checkBox)
checkBox.translatesAutoresizingMaskIntoConstraints = false
checkBox.widthAnchor.constraint(equalToConstant: 20).isActive = true
checkBox.heightAnchor.constraint(equalToConstant: 20).isActive = true
if(latestCheckBox == nil) {
checkBox.topAnchor.constraint(equalTo: checkBoxesContainerView.topAnchor, constant: 0).isActive = true
checkBox.leadingAnchor.constraint(equalTo: checkBoxesContainerView.leadingAnchor, constant: 0).isActive = true
} else {
checkBox.topAnchor.constraint(equalTo: latestCheckBox!.topAnchor, constant: 8).isActive = true
checkBox.leadingAnchor.constraint(equalTo: latestCheckBox!.leadingAnchor, constant: 0).isActive = true
}
latestCheckBox = checkBox
}
}
Пожалуйста, помогите! Нет флажков на экране (