Add separator line to section headers so that they don't look smooshed together when collapsed

This commit is contained in:
Maurice Parker 2019-09-03 13:00:31 -05:00
parent 4bce625f18
commit 960f09826b
2 changed files with 19 additions and 20 deletions

View File

@ -70,6 +70,18 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView {
return iView
}()
private let topSeparatorView: UIView = {
let view = UIView()
view.backgroundColor = UIColor.separator
return view
}()
private let bottomSeparatorView: UIView = {
let view = UIView()
view.backgroundColor = UIColor.separator
return view
}()
override init(reuseIdentifier: String?) {
super.init(reuseIdentifier: reuseIdentifier)
commonInit()
@ -114,6 +126,8 @@ private extension MasterFeedTableViewSectionHeader {
updateDisclosureImage()
addSubviewAtInit(disclosureView)
addBackgroundView()
addSubviewAtInit(topSeparatorView)
addSubviewAtInit(bottomSeparatorView)
}
func updateDisclosureImage() {
@ -133,6 +147,11 @@ private extension MasterFeedTableViewSectionHeader {
titleView.setFrameIfNotEqual(layout.titleRect)
unreadCountView.setFrameIfNotEqual(layout.unreadCountRect)
disclosureView.setFrameIfNotEqual(layout.disclosureButtonRect)
let top = CGRect(x: safeAreaInsets.left, y: 0, width: frame.width - safeAreaInsets.right - safeAreaInsets.left, height: 0.5)
topSeparatorView.setFrameIfNotEqual(top)
let bottom = CGRect(x: safeAreaInsets.left, y: frame.height - 0.5, width: frame.width - safeAreaInsets.right - safeAreaInsets.left, height: 0.5)
bottomSeparatorView.setFrameIfNotEqual(bottom)
}
func addBackgroundView() {

View File

@ -1,20 +0,0 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
},
"colors" : [
{
"idiom" : "universal",
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "177",
"alpha" : "1.000",
"blue" : "177",
"green" : "177"
}
}
}
]
}