Fixed rendering on phones with the notch by taking into consideration cell safe area insets.
This commit is contained in:
parent
a9ef76d8fc
commit
e31be75d95
@ -112,7 +112,7 @@ class MasterTableViewCell : UITableViewCell {
|
|||||||
|
|
||||||
override func layoutSubviews() {
|
override func layoutSubviews() {
|
||||||
super.layoutSubviews()
|
super.layoutSubviews()
|
||||||
let layout = MasterTableViewCellLayout(cellSize: bounds.size, shouldShowImage: shouldShowImage, label: titleView, unreadCountView: unreadCountView, showingEditingControl: showingEditControl, indent: indentationLevel == 1, shouldShowDisclosure: !showsReorderControl)
|
let layout = MasterTableViewCellLayout(cellSize: bounds.size, insets: safeAreaInsets, shouldShowImage: shouldShowImage, label: titleView, unreadCountView: unreadCountView, showingEditingControl: showingEditControl, indent: indentationLevel == 1, shouldShowDisclosure: !showsReorderControl)
|
||||||
layoutWith(layout)
|
layoutWith(layout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,9 +25,9 @@ struct MasterTableViewCellLayout {
|
|||||||
let unreadCountRect: CGRect
|
let unreadCountRect: CGRect
|
||||||
let disclosureButtonRect: CGRect
|
let disclosureButtonRect: CGRect
|
||||||
|
|
||||||
init(cellSize: CGSize, shouldShowImage: Bool, label: UILabel, unreadCountView: MasterUnreadCountView, showingEditingControl: Bool, indent: Bool, shouldShowDisclosure: Bool) {
|
init(cellSize: CGSize, insets: UIEdgeInsets, shouldShowImage: Bool, label: UILabel, unreadCountView: MasterUnreadCountView, showingEditingControl: Bool, indent: Bool, shouldShowDisclosure: Bool) {
|
||||||
|
|
||||||
var initialIndent = MasterTableViewCellLayout.marginLeft
|
var initialIndent = MasterTableViewCellLayout.marginLeft + insets.left
|
||||||
if indent {
|
if indent {
|
||||||
initialIndent += MasterTableViewCellLayout.indent
|
initialIndent += MasterTableViewCellLayout.indent
|
||||||
}
|
}
|
||||||
@ -35,7 +35,7 @@ struct MasterTableViewCellLayout {
|
|||||||
initialIndent += MasterTableViewCellLayout.editingControlIndent
|
initialIndent += MasterTableViewCellLayout.editingControlIndent
|
||||||
}
|
}
|
||||||
|
|
||||||
let bounds = CGRect(x: initialIndent, y: 0.0, width: floor(cellSize.width - initialIndent), height: floor(cellSize.height))
|
let bounds = CGRect(x: initialIndent, y: 0.0, width: floor(cellSize.width - initialIndent - insets.right), height: floor(cellSize.height))
|
||||||
|
|
||||||
// Favicon
|
// Favicon
|
||||||
var rFavicon = CGRect.zero
|
var rFavicon = CGRect.zero
|
||||||
|
@ -71,7 +71,7 @@ class MasterTableViewSectionHeader: UITableViewHeaderFooterView {
|
|||||||
|
|
||||||
override func layoutSubviews() {
|
override func layoutSubviews() {
|
||||||
super.layoutSubviews()
|
super.layoutSubviews()
|
||||||
let layout = MasterTableViewCellLayout(cellSize: bounds.size, shouldShowImage: false, label: titleView, unreadCountView: unreadCountView, showingEditingControl: false, indent: true, shouldShowDisclosure: false)
|
let layout = MasterTableViewCellLayout(cellSize: bounds.size, insets: safeAreaInsets, shouldShowImage: false, label: titleView, unreadCountView: unreadCountView, showingEditingControl: false, indent: true, shouldShowDisclosure: false)
|
||||||
layoutWith(layout)
|
layoutWith(layout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,6 +489,8 @@ class MasterViewController: UITableViewController, UndoableCommandRunner {
|
|||||||
cell.delegate = self
|
cell.delegate = self
|
||||||
if node.parent?.representedObject is Folder {
|
if node.parent?.representedObject is Folder {
|
||||||
cell.indentationLevel = 1
|
cell.indentationLevel = 1
|
||||||
|
} else {
|
||||||
|
cell.indentationLevel = 0
|
||||||
}
|
}
|
||||||
cell.disclosureExpanded = expandedNodes.contains(node)
|
cell.disclosureExpanded = expandedNodes.contains(node)
|
||||||
cell.allowDisclosureSelection = node.canHaveChildNodes
|
cell.allowDisclosureSelection = node.canHaveChildNodes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user