Поскольку вы хотите иметь 4 кнопки по горизонтали, я бы предложил вам использовать UIStackView
с vertical axis
. Вы можете установить его contentMode
как Fill Equally
и добавить 4 кнопки в качестве детей в UIStackView
. Что касается вашего вопроса «как ограничение, вид программно», это то, как вы можете достичь этого (это просто пример вида ограничения на нижней части экрана, с высотой, равной 80):
var yourView = UIView()
// Pin the leading edge of yourView to the leading edge of the main view
yourView.leadingAnchor.constraintEqualToAnchor(view.leadingAnchor).active = true
// Pin the trailing edge of yourView to the leading trailing edge
yourView.trailingAnchor.constraintEqualToAnchor(view.trailingAnchor).active = true
// Pin the bottomedge of yourView to the margin's leading edge
yourView .bottomAnchor.constraintEqualToAnchor(view.bottomAnchor).active = true
// The height of your view
yourView.heightAnchor.constraintEqualToConstant(80).active = true
, что есть вы пробовали? Добавьте код. есть довольно хорошее объяснение ограничений установки здесь http://stackoverflow.com/questions/31651022/how-to-create-layout-constraints-programmatically – HarmVanRisk