Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // standard constraint syntax
- NSLayoutConstraint.activate([
- avatar.widthAnchor.constraint(equalToConstant: 40.0),
- avatar.heightAnchor.constraint(equalToConstant: 40.0),
- stack.topAnchor.constraint(equalTo: titleView.topAnchor),
- stack.leadingAnchor.constraint(equalTo: titleView.leadingAnchor),
- stack.trailingAnchor.constraint(lessThanOrEqualTo: titleView.trailingAnchor),
- stack.bottomAnchor.constraint(equalTo: titleView.bottomAnchor),
- ])
- let c = titleView.widthAnchor.constraint(equalToConstant: CGFloat.greatestFiniteMagnitude)
- c.priority = .defaultLow
- c.isActive = true
- // or, if you want to use SnapKit
- avatar.snp.makeConstraints { make in
- make.width.height.equalTo(40)
- }
- stack.snp.makeConstraints { make in
- make.top.leading.trailing.bottom.equalToSuperview()
- }
- titleView.snp.makeConstraints { make in
- make.width.equalTo(CGFloat.greatestFiniteMagnitude).priority(.low)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement