I want to add a expandable tableview . After clicking the cell it should expand an other tableview inside it. I am sharing the screen shots.
Now i want after clicking the cell it should expand till the height of all data. and the view should be like this.
my code is
func ParseJSON(){
var MenuList = [Menu]()
Alamofire.request(.GET, myUrl)
.validate()
.responseJSON { response in
switch response.result
{
case .Success:
if let value = response.result.value {
let json = JSON(value)
// print("JSON: \(json)")
for entity in json{
print(entity)
}
}
case .Failure(let error):
print(error)
}
}
}
my modal class is
import UIKit
class Menu {
var id: Int?
var name: String?
var image: UIImage?
var coupon: Int?
var icon: UIImage?
var order: Int?
var aname: Int?
var options: Int?
init(id:Int,name:String,image:UIImage,coupon:Int,icon:UIImage,order:Int,aname:Int,options:Int){
self.id = id
self.name = name
self.image = image
self.coupon = coupon
self.icon = icon
self.order = order
self.aname = aname
self.options = options
}
}
how can i populate the menu names in tableview.after that when clicking in this tableview will expand till the size of whole data under which i am going to display the subcategory name.
see the json data:
[
{
"id": "244",
"name": "PIZZAS",
"image": "",
"coupon": "1",
"icon": "",
"order": "1",
"aname": "",
"options": "2",
"subcategory": [
{
"id": "515",
"name": "MARGARITA",
"description": "Cheese and Tomato",
"image": "",
"icon": "",
"coupon": "1",
"order": "1",
"aname": "",
"options": "2",
"item": [
{
"id": "1749",
"name": "9 Inch Thin & Crispy Margarita",
"description": "",
"price": "3.40",
"coupon": "1",
"image": "",
"options": "2",
"order": "1",
"addon": "495",
"aname": "",
"icon": ""
}]
}]
}]