objective c - TreeView in IOS rearrange following Subviews after adding or removing subviews from Scrollview -


i try create n-dimensional treeview control ios application. use uiviewcontroller uiscrollview , have custom uiview class treenodes. want collapse , expand treenodes, if add or remove subviews scroll view have rearrange other subviews.

this tree:

enter image description here

if collapse second node , remove childnodes looks that:

enter image description here

is there way realise that, without programatically rearrange following subviews?

you realized lot of code? because use tableview.

as datasource of table can use array of dictionary; , in each dictionary can store rows informations like:

row element;// current element display

parent element;//* parent element

generation; //nsinteger number of parents (you can use indentation)

so when delete row, can search in datasource items parent element, , substitute parent of deleted row (if exists); decrement generation them, , recursively children (until find no more children).

of course, when populating tableview can use generation number make indentation.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -