Search
Write a publication
Pull to refresh

Comments 3

Далее закрепляем его констрейнтами с отступом в 2 pix со всех сторон.

Вот поэтому Interface Builder — зло.
Это всё равно, что в коде дублировать литералы, не пользуясь константами.
Да, как здесь:

@IBAction func buttonOne(_ sender: UIButton) {
    checkButtonOne.priority = UILayoutPriority(rawValue: 950)
    checkButtonTwo.priority = UILayoutPriority(rawValue: 750)
    UIView.animate(withDuration: 0.5) {
        self.view.layoutIfNeeded()
    }
}
    
@IBAction func buttonTwo(_ sender: UIButton) {
    checkButtonOne.priority = UILayoutPriority(rawValue: 750)
    checkButtonTwo.priority = UILayoutPriority(rawValue: 950)
    UIView.animate(withDuration: 0.5) {
        self.view.layoutIfNeeded()
    }
}
Sign up to leave a comment.

Articles