So I'm trying making a multi-level UITableView
by using UITableView inside UITableViewCell
. Let me explain first:
- Red color is Main
UITableView
- Blue color is Section, so I use as SectionHeader, and add UIButton into it, so can be expanded, and
- Green Color, is the
cellForRow
that include UITableView inside cell. - The flow is, I get all Blue color items which is each Blue Color have children Green
- In this logic, if I want to show all blue color as section, so in
numberOfSection
Ireturn [blueData count];
- And
numberOfRowsInSection
, of course I get fromGreenModel *greenData = [blueData.greenData count];
- In cellForRow, I'm using
UITableView
inside cell, so I defineblueDatarArray
and pass it into cell with properties, like this:cell.greenDataArray = [blueDataArray.greenData mutableCopy];
- In
UITableViewCell
I haveUITableView
, which is there will beUITableView Delegate
andUITableView DataSource
- Continue from number 8, I also use a header as return greenData array, which is, from blue having a child is green, and I set in number of section in
UITableViewCell
's delegate and data source is,numberOfSections
in green tableview is refer from number 7 as[greenDataArray count];
so it will be used for header, and also I give button too into it, used to expand and collapse later. - Also in cellForRow, it return
[greenData.child count]
- And finally in cellForRow is only show up greenData's child but does not appear, take a look at the picture the green having 4 children, but when. I trigger the button, it wont show up... why? I use same logic as red and blue.
How to show greenData's child?