NSArray *columns = @[
@{ @
"title"
: @
"Column 1"
, @
"subtitle"
: @
"This is first column"
},
@{ @
"title"
: @
"Column 2"
, @
"subcolumns"
: @[
@{ @
"title"
: @
"Column 2.1"
, @
"headerHeight"
: @20},
@{ @
"title"
: @
"Column 2.2"
, @
"headerHeight"
: @20}]},
@{ @
"title"
: @
"Column 3"
, @
"titleColor"
: @
"FF00CF00"
}
];
NSArray *rows = @[
@{ @
"cells"
: @[
@{ @
"value"
: @
"Value 1"
},
@{ @
"value"
: @1},
@{ @
"value"
: @2},
@{ @
"value"
: @3}
]
},
@{ @
"cells"
: @[
@{ @
"value"
: @
"Value 2"
},
@{ @
"value"
: @2},
@{ @
"value"
: @3},
@{ @
"value"
: @4}
]
}
];
TSTableView *tableView = [[TSTableView alloc] initWithFrame:self.view.bounds];
tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
tableView.delegate = self;
[self.view addSubview:tableView];
TSTableViewModel *dataModel = [[TSTableViewModel alloc] initWithTableView:tableView andStyle:kTSTableViewStyleDark];
[dataModel setColumns:columns andRows:rows];