RATreeView icon indicating copy to clipboard operation
RATreeView copied to clipboard

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

Open girishghoda opened this issue 8 years ago • 2 comments

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.

girishghoda avatar Feb 04 '17 09:02 girishghoda

@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)
}

stolkachov avatar Nov 26 '17 08:11 stolkachov

treeView.allowsSelection = false

will disable click into cell

fukemy avatar Jan 04 '22 22:01 fukemy