4

I am stuck at the point where I want to delete the particular Row Object from table but It is dynamic tree structure means object can be created, deleted, reordered, etc at any time using all the Table methods.

Tree Structure is dynamic so How to reach to the Leaf Object OR Intermediate Object which need to deleted. Traverse in all the Branches as well.

Here It can be any number of nodes, child nodes, parent nodes. But I need to Traverse all the nodes upto all the Leaf nodes .

So, my question is to delete any node?

If you have ideas, suggestions about this problem so your solutions accepted.

Thanks in Advance.

Tree Example as below:

enter image description here

krunal
  • 452
  • 3
  • 11

1 Answers1

0

Add the TapGesture to tableviewCell then you will get the tap point to find out indexPath of currentCell.

Accordingly you can easily find out the current cell you selected.

Let me know if you need it in more detail.

Preetam Jadakar
  • 4,479
  • 2
  • 28
  • 58
  • No I don't want to selection for that. I have created that Row selection and Deletion code. But what happen when I have tree length from ROOT to LEAF NODE is 10. I want to delete "Green" colored background cell. so what should I do. Should I need to Traverse the whole Array OR How can I determine that "Green" colored cell is whose child? – krunal Apr 03 '14 at 11:34
  • You can create a class structure so that each object has info of its child or parents. If the data is less you can directly check by traversing array – Preetam Jadakar Apr 03 '14 at 12:47
  • @krunal how did you manage to load this Data into a UITableView? IN my case, the data can go up to n number of nodes. How did you traverse along this data set? – nr5 Jul 24 '17 at 11:19
  • 1
    @Nil You have 2 ways to load data into Table. 1) Flat Array which have child-parent relationship using Specific Identifier. So when you have find a particular row is a child of a parent then you can set indentation level property of TableView. 2) Nested Array using RA TreeView Third Party Library where you can find all kind of examples and idea as well. – krunal Jul 27 '17 at 08:08