Augustyniak / RATreeView

Library providing easy-to-use interface for displaying tree structures on iOS and tvOS.
MIT License
2.49k stars 465 forks source link

Expand/Collapse only when tap on button not on cell touch #209

Open girishghoda opened 7 years ago

girishghoda commented 7 years ago

hey @Augustyniak nice library but i don't want to expand/collapse on cell touch but i want to expand/collapse tap on button putted right side in cell. Any help Thank you.

stolkachov commented 6 years ago

@girishghoda you can achieve this by 1) Disabling selection of cells for RATreeView: treeView.allowsSelection = false 2) and then manually expand/collapse cell on a button touch:

// Check current expand/collapse state of cell
let isExpanded = treeView.isCell(forItemExpanded: item)
// Expand or collapse cell
if isExpanded {
    treeView.collapseRow(forItem: item, collapseChildren: true, with: RATreeViewRowAnimationAutomatic)
} else {
    treeView.expandRow(forItem: item, expandChildren: false, with: RATreeViewRowAnimationAutomatic)
}
fukemy commented 2 years ago
treeView.allowsSelection = false

will disable click into cell