I want to create dynamic layout according to json response getting from server. I'm confused between methodology using views with constraints or using tableview to achieve this layout. I have researched another approach is that make the different kinds of xib views, after parsing the response, checked every element type and call the respective view in tableview cell. I just want a suggestion how can i create this layout in better way.
The json response is:
"data": {
"elementperrowtwo": {
[
{
“fieldid”: “1”,
“fieldtype”: “label”,
“fieldtext”: “OrderDate”,
“fieldcontrolno”: ”1”,
“displaycolumntype”: “2”
},
{
“fieldid”: “2”,
“fieldtype”: “textfield”,
“fieldtext”: “”,
“fieldcontrolno”: ”2”,
“displaycolumntype”: “2”
},
{
“fieldid”: “3”,
“fieldtype”: “label”,
“fieldtext”: “OurReference”,
“fieldcontrolno”: ”1”,
“displaycolumntype”: “2”
},
{
“fieldid”: “4”,
“fieldtype”: “textfield”,
“fieldtext”: “”,
“fieldcontrolno”: ”2”,
“displaycolumntype”: “2”
}
],
"elementperrowone": [
{
“fieldid”: “8”,
“fieldtype”: “label”,
“fieldtext”: “Buyer”,
“fieldcontrolno”: ”1”,
“displaycolumntype”: “1”
},
{
“fieldid”: “9”,
“fieldtype”: “textfield”,
“fieldtext”: “”,
“fieldcontrolno”: ”2”,
“displaycolumntype”: “1”
},
{
“fieldid”: “16”,
“fieldtype”: “dropdown”,
“fieldarray”: [
{
“id”: “1”,
“name”: “australia”
},
{
“id”: “2”,
“name”: “china”
},
{
“id”: “3”,
“name”: “India”
}
],
“fieldcontrolno”: ”3”,
“displaycolumntype”: “1”
}
]
}