mirror of
https://github.com/mastodon/mastodon-ios
synced 2025-04-11 22:58:02 +02:00
fix: iOS 15 new section padding issue
This commit is contained in:
parent
cc36d473c5
commit
5272f3de67
@ -44,6 +44,11 @@ final class MastodonPickServerViewController: UIViewController, NeedsDependency
|
||||
tableView.backgroundColor = .clear
|
||||
tableView.keyboardDismissMode = .onDrag
|
||||
tableView.translatesAutoresizingMaskIntoConstraints = false
|
||||
if #available(iOS 15.0, *) {
|
||||
tableView.sectionHeaderTopPadding = .leastNonzeroMagnitude
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
return tableView
|
||||
}()
|
||||
|
||||
@ -428,7 +433,9 @@ extension MastodonPickServerViewController: UITableViewDelegate {
|
||||
}
|
||||
|
||||
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
|
||||
guard let diffableDataSource = viewModel.diffableDataSource else { return 0 }
|
||||
guard let diffableDataSource = viewModel.diffableDataSource else {
|
||||
return .leastNonzeroMagnitude
|
||||
}
|
||||
let sections = diffableDataSource.snapshot().sectionIdentifiers
|
||||
let section = sections[section]
|
||||
switch section {
|
||||
@ -442,10 +449,20 @@ extension MastodonPickServerViewController: UITableViewDelegate {
|
||||
// Same reason as above
|
||||
return 10
|
||||
case .servers:
|
||||
return 0
|
||||
return .leastNonzeroMagnitude
|
||||
}
|
||||
}
|
||||
|
||||
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
|
||||
let footerView = UIView()
|
||||
footerView.backgroundColor = .yellow
|
||||
return footerView
|
||||
}
|
||||
|
||||
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
|
||||
return .leastNonzeroMagnitude
|
||||
}
|
||||
|
||||
func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? {
|
||||
guard let diffableDataSource = viewModel.diffableDataSource else { return nil }
|
||||
guard let item = diffableDataSource.itemIdentifier(for: indexPath) else { return nil }
|
||||
|
@ -26,6 +26,8 @@ extension SidebarAddAccountCollectionViewCell {
|
||||
private func _init() { }
|
||||
|
||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||
super.updateConfiguration(using: state)
|
||||
|
||||
var newBackgroundConfiguration = UIBackgroundConfiguration.listSidebarCell().updated(for: state)
|
||||
|
||||
// Customize the background color to use the tint color when the cell is highlighted or selected.
|
||||
|
Loading…
x
Reference in New Issue
Block a user