forked from zelo72/mastodon-ios
fix: use readable guider to layout section header
This commit is contained in:
parent
901176e14d
commit
db3d16be41
|
@ -121,3 +121,5 @@ xcuserdata
|
|||
|
||||
Localization/StringsConvertor/input
|
||||
Localization/StringsConvertor/output
|
||||
.DS_Store
|
||||
/Mastodon.xcworkspace/xcshareddata/swiftpm
|
||||
|
|
|
@ -1161,8 +1161,8 @@
|
|||
5B90C455262599800002E742 /* Settings */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5B90C456262599800002E742 /* SettingsViewModel.swift */,
|
||||
5B90C457262599800002E742 /* View */,
|
||||
5B90C456262599800002E742 /* SettingsViewModel.swift */,
|
||||
5B90C45D262599800002E742 /* SettingsViewController.swift */,
|
||||
);
|
||||
path = Settings;
|
||||
|
|
|
@ -7,6 +7,11 @@
|
|||
|
||||
import UIKit
|
||||
|
||||
struct GroupedTableViewConstraints {
|
||||
static let topMargin: CGFloat = 40
|
||||
static let bottomMargin: CGFloat = 10
|
||||
}
|
||||
|
||||
/// section header which supports add a custom view blelow the title
|
||||
class SettingsSectionHeader: UIView {
|
||||
lazy var titleLabel: UILabel = {
|
||||
|
@ -21,7 +26,12 @@ class SettingsSectionHeader: UIView {
|
|||
let view = UIStackView()
|
||||
view.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.isLayoutMarginsRelativeArrangement = true
|
||||
view.layoutMargins = UIEdgeInsets(top: 40, left: 12, bottom: 10, right: 12)
|
||||
view.layoutMargins = UIEdgeInsets(
|
||||
top: GroupedTableViewConstraints.topMargin,
|
||||
left: 0,
|
||||
bottom: GroupedTableViewConstraints.bottomMargin,
|
||||
right: 0
|
||||
)
|
||||
view.axis = .vertical
|
||||
return view
|
||||
}()
|
||||
|
@ -37,8 +47,8 @@ class SettingsSectionHeader: UIView {
|
|||
|
||||
addSubview(stackView)
|
||||
NSLayoutConstraint.activate([
|
||||
stackView.leadingAnchor.constraint(equalTo: self.leadingAnchor),
|
||||
stackView.trailingAnchor.constraint(lessThanOrEqualTo: self.trailingAnchor),
|
||||
stackView.leadingAnchor.constraint(equalTo: self.readableContentGuide.leadingAnchor),
|
||||
stackView.trailingAnchor.constraint(lessThanOrEqualTo: self.readableContentGuide.trailingAnchor),
|
||||
stackView.bottomAnchor.constraint(equalTo: self.bottomAnchor),
|
||||
stackView.topAnchor.constraint(equalTo: self.topAnchor),
|
||||
])
|
||||
|
|
Loading…
Reference in New Issue