Reputation: 4470
I have the following json data
{
"Display_Selected List":
[
{
"product_name": "Product1",
"items":
[
{
"item_name": "SubItem1",
"specifications":
[
{
"list": [
{
"name": "Sp1"
},
{
"name": "Sp2"
}
],
"specification_name": "Specification Group 1"
},
{
"list": [
{
"name": "Sp3"
},
{
"name": "Sp4"
}
],
"specification_name": "Specification Group 2"
}
]
},
{
"item_name": "Sub Item2",
"specifications":
[
{
"list": [
{
"name": "Sp2"
}
],
"specification_name": "Specification Group 1"
},
{
"list": [
{
"name": "Sp3"
}
],
"specification_name": "Specification Group 2"
}
]
}
]
},
{
"product_name": "Product2",
"items":
[
{
"item_name": "Item1",
"specifications":
[
{
"list": [
{
"name": "Sp3"
},
{
"name": "Sp4"
}
],
"specification_name": "Specification Group 2"
}
]
}
]
}
]
}
As per the design requirement i have to diplay this whole data in single uitable view like follow I have created rough design as shown in below image
I can achieve this via
uitableview
insideuitableviewcell
but as per Apple recommendation Apple does not recommend table views to be added as subviews of other scrollable objects
Now my question is how can i achieve following design by single uitableview and and also as per my json all the content are dynamic
Does anyone have seen something like this around ? Any reference would be helpful.
Upvotes: 2
Views: 1564
Reputation: 2714
If you don't wish to use tableView
inside tableViewCell
, you could possible go by the following approach.
numberOfRowsInSection
will have the correct count to show data using the above created cells. So numberOfRows should return the total count like rowsInSection =
count of items + count of specifications in each items + count of list in each specifications for each itemI hope this approach will help you achieve the result.
It will be easy if you could use tableView
inside the tableViewCell
, in many Applications I have used this approach and I haven't faced any Apple review problem. If you are using tableView
inside tableViewCell
it would be better to disable scrolling and bounces property.
Upvotes: 2