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:
if collapse second node , remove childnodes looks that:
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
Post a Comment