How to add constraints programmatically using Swift

前端 未结 17 1415
逝去的感伤
逝去的感伤 2020-11-21 23:07

I\'m trying to figure this out since last week without going any step further. Ok, so I need to apply some constraints programmatically

17条回答
  •  轮回少年
    2020-11-21 23:39

    If you find the above to be ugly. You should consider using a DSL for constraints. Such as SnapKit Makes constraint API much more user-friendly

    view.snp.makeConstraints { make in
        make.edges.equalToSuperview()
    }
    

提交回复
热议问题