objective c - Multiple rows inside table view cell for tableview -
i have array of objects display information of inside table view. trying find examples on web on how display multiple columns per row or @ least give impression of multiple columns.
for example.
object person -firstname -lastname
my array has collection of multiple person objects.
i want display data such:
john smith
jane doh
don johnson
marco polo
so far have this
-(uitableviewcell *)tableview:(uitableview*)tableview cellforrowatindexpath:(nsindexpath *)indexpath { uitableviewcell * cell = [tableview dequeuereusablecellwithidentifier:@"maincell"]; if(cell==nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"maincell"]; } person *item = [self.data objectatindex:indexpath.row]; cell.textlabel.text = item.firstname; //add rest of properties separate columns return cell; }
what best approach this?
for column behavior can add label on cell , display text on label.
cell.label1.text = item.firstname; cell.label2.text = item.lastname; cell.label3.text = item.city;
design cell according requirement , provide frame label looks column in table view :)
Comments
Post a Comment