Minor UI-improvements in UserView (IOS-157)
Make avatar-image bigger, fix position of follow-button
This commit is contained in:
parent
a7364c77ba
commit
a2729b17c5
|
@ -100,6 +100,12 @@ public final class UserView: UIView {
|
||||||
return label
|
return label
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
private let followButtonWrapper = {
|
||||||
|
let wrapper = UIView()
|
||||||
|
|
||||||
|
return wrapper
|
||||||
|
}()
|
||||||
|
|
||||||
private let followButton: FollowButton = {
|
private let followButton: FollowButton = {
|
||||||
let button = FollowButton()
|
let button = FollowButton()
|
||||||
button.cornerRadius = 10
|
button.cornerRadius = 10
|
||||||
|
@ -149,10 +155,7 @@ extension UserView {
|
||||||
|
|
||||||
avatarButton.translatesAutoresizingMaskIntoConstraints = false
|
avatarButton.translatesAutoresizingMaskIntoConstraints = false
|
||||||
containerStackView.addArrangedSubview(avatarButton)
|
containerStackView.addArrangedSubview(avatarButton)
|
||||||
NSLayoutConstraint.activate([
|
|
||||||
avatarButton.widthAnchor.constraint(equalToConstant: 28).priority(.required - 1),
|
|
||||||
avatarButton.heightAnchor.constraint(equalToConstant: 28).priority(.required - 1),
|
|
||||||
])
|
|
||||||
avatarButton.setContentHuggingPriority(.defaultLow, for: .vertical)
|
avatarButton.setContentHuggingPriority(.defaultLow, for: .vertical)
|
||||||
avatarButton.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
avatarButton.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
||||||
|
|
||||||
|
@ -162,7 +165,19 @@ extension UserView {
|
||||||
containerStackView.addArrangedSubview(labelStackView)
|
containerStackView.addArrangedSubview(labelStackView)
|
||||||
|
|
||||||
// follow button
|
// follow button
|
||||||
containerStackView.addArrangedSubview(followButton)
|
followButtonWrapper.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
followButtonWrapper.addSubview(followButton)
|
||||||
|
|
||||||
|
containerStackView.addArrangedSubview(followButtonWrapper)
|
||||||
|
|
||||||
|
NSLayoutConstraint.activate([
|
||||||
|
followButton.topAnchor.constraint(lessThanOrEqualTo: avatarButton.topAnchor),
|
||||||
|
followButton.leadingAnchor.constraint(equalTo: followButtonWrapper.leadingAnchor),
|
||||||
|
followButtonWrapper.trailingAnchor.constraint(equalTo: followButton.trailingAnchor),
|
||||||
|
followButtonWrapper.bottomAnchor.constraint(greaterThanOrEqualTo: followButton.bottomAnchor),
|
||||||
|
|
||||||
|
followButtonWrapper.heightAnchor.constraint(equalTo: containerStackView.heightAnchor),
|
||||||
|
])
|
||||||
|
|
||||||
let nameStackView = UIStackView()
|
let nameStackView = UIStackView()
|
||||||
nameStackView.axis = .horizontal
|
nameStackView.axis = .horizontal
|
||||||
|
@ -182,6 +197,13 @@ extension UserView {
|
||||||
|
|
||||||
labelStackView.addArrangedSubview(nameStackView)
|
labelStackView.addArrangedSubview(nameStackView)
|
||||||
|
|
||||||
|
NSLayoutConstraint.activate([
|
||||||
|
avatarButton.heightAnchor.constraint(lessThanOrEqualToConstant: 56),
|
||||||
|
avatarButton.widthAnchor.constraint(greaterThanOrEqualToConstant: 28),
|
||||||
|
avatarButton.heightAnchor.constraint(equalTo: avatarButton.widthAnchor),
|
||||||
|
avatarButton.heightAnchor.constraint(equalTo: labelStackView.heightAnchor),
|
||||||
|
])
|
||||||
|
|
||||||
let verifiedSpacerView = UIView()
|
let verifiedSpacerView = UIView()
|
||||||
let verifiedStackTrailingSpacerView = UIView()
|
let verifiedStackTrailingSpacerView = UIView()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue