feat: Fix follow hashtags header layout
This commit is contained in:
parent
178a6e503a
commit
9d245d3205
|
@ -25,6 +25,8 @@ final class HashtagTimelineHeaderView: UIView {
|
||||||
let participantsDescLabel = UILabel()
|
let participantsDescLabel = UILabel()
|
||||||
let postsTodayDescLabel = UILabel()
|
let postsTodayDescLabel = UILabel()
|
||||||
|
|
||||||
|
private var widthConstraint: NSLayoutConstraint!
|
||||||
|
|
||||||
let followButton: UIButton = {
|
let followButton: UIButton = {
|
||||||
let button = RoundedEdgesButton(type: .custom)
|
let button = RoundedEdgesButton(type: .custom)
|
||||||
button.cornerRadius = 10
|
button.cornerRadius = 10
|
||||||
|
@ -67,8 +69,12 @@ private extension HashtagTimelineHeaderView {
|
||||||
postCountDescLabel.text = "posts"
|
postCountDescLabel.text = "posts"
|
||||||
participantsDescLabel.text = "participants"
|
participantsDescLabel.text = "participants"
|
||||||
postsTodayDescLabel.text = "posts today"
|
postsTodayDescLabel.text = "posts today"
|
||||||
|
|
||||||
|
widthConstraint = widthAnchor.constraint(equalToConstant: 0)
|
||||||
|
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
|
widthConstraint,
|
||||||
|
|
||||||
titleLabel.topAnchor.constraint(equalTo: topAnchor, constant: .padding),
|
titleLabel.topAnchor.constraint(equalTo: topAnchor, constant: .padding),
|
||||||
titleLabel.leadingAnchor.constraint(equalTo: leadingAnchor, constant: .padding),
|
titleLabel.leadingAnchor.constraint(equalTo: leadingAnchor, constant: .padding),
|
||||||
titleLabel.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -CGFloat.padding),
|
titleLabel.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -CGFloat.padding),
|
||||||
|
@ -106,4 +112,8 @@ extension HashtagTimelineHeaderView {
|
||||||
titleLabel.text = "#\(entity.name)"
|
titleLabel.text = "#\(entity.name)"
|
||||||
followButton.setTitle(entity.following == true ? "Unfollow" : "Follow", for: .normal)
|
followButton.setTitle(entity.following == true ? "Unfollow" : "Follow", for: .normal)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateWidthConstraint(_ constant: CGFloat) {
|
||||||
|
widthConstraint.constant = constant
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,6 +178,11 @@ extension HashtagTimelineViewController {
|
||||||
}
|
}
|
||||||
headerView.update(tag)
|
headerView.update(tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func viewDidLayoutSubviews() {
|
||||||
|
super.viewDidLayoutSubviews()
|
||||||
|
headerView.updateWidthConstraint(tableView.bounds.width)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension HashtagTimelineViewController {
|
extension HashtagTimelineViewController {
|
||||||
|
|
Loading…
Reference in New Issue