Fixed disclosure icon so that it only works on node that can have child nodes.
This commit is contained in:
parent
7e14f8bcd3
commit
48ab0cd733
|
@ -17,9 +17,8 @@ protocol MasterTableViewCellDelegate: class {
|
|||
|
||||
class MasterTableViewCell : UITableViewCell {
|
||||
|
||||
private var accessoryButton: UIButton?
|
||||
|
||||
weak var delegate: MasterTableViewCellDelegate?
|
||||
var allowDisclosureSelection = false
|
||||
|
||||
override var accessibilityLabel: String? {
|
||||
set {}
|
||||
|
@ -93,8 +92,9 @@ class MasterTableViewCell : UITableViewCell {
|
|||
|
||||
private let unreadCountView = MasterUnreadCountView(frame: CGRect.zero)
|
||||
private var showingEditControl = false
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
private var accessoryButton: UIButton?
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
super.init(coder: coder)
|
||||
commonInit()
|
||||
}
|
||||
|
@ -112,6 +112,10 @@ class MasterTableViewCell : UITableViewCell {
|
|||
|
||||
@objc func buttonPressed(_ sender: UIButton) {
|
||||
|
||||
guard allowDisclosureSelection else {
|
||||
return
|
||||
}
|
||||
|
||||
if sender.imageView?.image == AppAssets.chevronRightImage {
|
||||
sender.setImage(AppAssets.chevronDownImage, for: .normal)
|
||||
delegate?.disclosureSelected(self, expanding: true)
|
||||
|
|
|
@ -303,6 +303,7 @@ class MasterViewController: UITableViewController, UndoableCommandRunner {
|
|||
|
||||
func configure(_ cell: MasterTableViewCell, _ node: Node) {
|
||||
cell.delegate = self
|
||||
cell.allowDisclosureSelection = node.canHaveChildNodes
|
||||
cell.name = nameFor(node)
|
||||
configureUnreadCount(cell, node)
|
||||
configureFavicon(cell, node)
|
||||
|
|
Loading…
Reference in New Issue