fix: use readable guider to layout section header
This commit is contained in:
parent
901176e14d
commit
db3d16be41
|
@ -120,4 +120,6 @@ xcuserdata
|
||||||
# End of https://www.toptal.com/developers/gitignore/api/swift,swiftpm,xcode,cocoapods
|
# End of https://www.toptal.com/developers/gitignore/api/swift,swiftpm,xcode,cocoapods
|
||||||
|
|
||||||
Localization/StringsConvertor/input
|
Localization/StringsConvertor/input
|
||||||
Localization/StringsConvertor/output
|
Localization/StringsConvertor/output
|
||||||
|
.DS_Store
|
||||||
|
/Mastodon.xcworkspace/xcshareddata/swiftpm
|
||||||
|
|
|
@ -1161,8 +1161,8 @@
|
||||||
5B90C455262599800002E742 /* Settings */ = {
|
5B90C455262599800002E742 /* Settings */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
5B90C456262599800002E742 /* SettingsViewModel.swift */,
|
|
||||||
5B90C457262599800002E742 /* View */,
|
5B90C457262599800002E742 /* View */,
|
||||||
|
5B90C456262599800002E742 /* SettingsViewModel.swift */,
|
||||||
5B90C45D262599800002E742 /* SettingsViewController.swift */,
|
5B90C45D262599800002E742 /* SettingsViewController.swift */,
|
||||||
);
|
);
|
||||||
path = Settings;
|
path = Settings;
|
||||||
|
|
|
@ -7,6 +7,11 @@
|
||||||
|
|
||||||
import UIKit
|
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
|
/// section header which supports add a custom view blelow the title
|
||||||
class SettingsSectionHeader: UIView {
|
class SettingsSectionHeader: UIView {
|
||||||
lazy var titleLabel: UILabel = {
|
lazy var titleLabel: UILabel = {
|
||||||
|
@ -21,7 +26,12 @@ class SettingsSectionHeader: UIView {
|
||||||
let view = UIStackView()
|
let view = UIStackView()
|
||||||
view.translatesAutoresizingMaskIntoConstraints = false
|
view.translatesAutoresizingMaskIntoConstraints = false
|
||||||
view.isLayoutMarginsRelativeArrangement = true
|
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
|
view.axis = .vertical
|
||||||
return view
|
return view
|
||||||
}()
|
}()
|
||||||
|
@ -37,8 +47,8 @@ class SettingsSectionHeader: UIView {
|
||||||
|
|
||||||
addSubview(stackView)
|
addSubview(stackView)
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
stackView.leadingAnchor.constraint(equalTo: self.leadingAnchor),
|
stackView.leadingAnchor.constraint(equalTo: self.readableContentGuide.leadingAnchor),
|
||||||
stackView.trailingAnchor.constraint(lessThanOrEqualTo: self.trailingAnchor),
|
stackView.trailingAnchor.constraint(lessThanOrEqualTo: self.readableContentGuide.trailingAnchor),
|
||||||
stackView.bottomAnchor.constraint(equalTo: self.bottomAnchor),
|
stackView.bottomAnchor.constraint(equalTo: self.bottomAnchor),
|
||||||
stackView.topAnchor.constraint(equalTo: self.topAnchor),
|
stackView.topAnchor.constraint(equalTo: self.topAnchor),
|
||||||
])
|
])
|
||||||
|
|
Loading…
Reference in New Issue