aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Tay <nick@windblume.net>2022-03-18 16:47:25 +1100
committerNicholas Tay <nick@windblume.net>2022-03-18 16:47:25 +1100
commit5d421e18cd6c8e633e7ca61e0255b511e2af40a8 (patch)
tree950fbeb18861fea9b35f4a2ef612de538ce90571
parenta44529a1c62ba58ed09c029f2a0f9c9e36099f21 (diff)
downloadforayios-5d421e18cd6c8e633e7ca61e0255b511e2af40a8.tar.gz
forayios-5d421e18cd6c8e633e7ca61e0255b511e2af40a8.tar.bz2
forayios-5d421e18cd6c8e633e7ca61e0255b511e2af40a8.zip
Use margins for new cell container + better image inset
Surely there still is a better way for the trailing constraints on the labels?
-rw-r--r--foray/ForayNewTableViewCell.swift25
1 files changed, 13 insertions, 12 deletions
diff --git a/foray/ForayNewTableViewCell.swift b/foray/ForayNewTableViewCell.swift
index e679a93..659589e 100644
--- a/foray/ForayNewTableViewCell.swift
+++ b/foray/ForayNewTableViewCell.swift
@@ -51,26 +51,27 @@ class ForayNewTableViewCell: UITableViewCell {
private func setupConstraints() {
container.snp.makeConstraints { (make) in
- make.top.bottom.equalToSuperview()
- make.trailing.leading.equalToSuperview().inset(12) // better way to do this?
+ make.edges.equalTo(contentView.snp.margins)
}
+ let imageWidth = 68
+ let imageHeight = 44
nameLabel.snp.makeConstraints { (make) in
- make.top.equalToSuperview().inset(8)
- make.leading.equalToSuperview().inset(8)
- make.trailing.equalTo(itemImageView.snp.trailing).inset(75) // better way to do this?
+ make.top.equalToSuperview()
+ make.leading.equalToSuperview()
+ make.trailing.equalTo(itemImageView.snp.trailing).inset(imageWidth)
}
descLabel.snp.makeConstraints { (make) in
make.top.equalTo(nameLabel.snp.bottom).offset(8)
- make.leading.equalToSuperview().inset(8)
- make.bottom.equalToSuperview().inset(8)
- make.trailing.equalTo(itemImageView.snp.trailing).inset(75) // better way to do this?
+ make.leading.equalToSuperview()
+ make.bottom.equalToSuperview()
+ make.trailing.equalTo(itemImageView.snp.trailing).inset(imageWidth)
}
itemImageView.snp.makeConstraints { (make) in
- make.top.equalToSuperview().inset(8)
- make.trailing.equalToSuperview().inset(8)
- make.width.equalTo(68)
- make.height.equalTo(44)
+ make.top.equalToSuperview()
+ make.trailing.equalToSuperview()
+ make.width.equalTo(imageWidth)
+ make.height.equalTo(imageHeight)
}
}