Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Narendar Singh

macrumors member
Original poster
Jun 22, 2012
76
0
INDIA
I know how to create Grouped Table, my basic understanding is that
- first we need to set no of sections
- then no of rows in each section
- then actually row/cell creation based on section

So what's wrong with me:
In my application at run time I can have Zero or maximum 3 sections.
I have 3 different array, based on their count I create sections.
Row layout is different in each section, for say
- section 1 row has 2 labels
- section 2 row has 2 images
- section 3 row has 3 labels

I was bit confused to render my data in grouped table. any help or any idea would be helpful.
 
In the cellForRowAtIndexPath you should set data appropriate for
the row and section.

So assuming that you're using standard uitableview cell then
in section 1 you would set the label text like
cell.detailTextLabel.text = labelText;

for rows in section 2 set the images like:
cell.imageView.image = rowImage;

see this guide for more info

http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/TableViewCells/TableViewCells.html%23//apple_ref/doc/uid/TP40007451-CH7-SW18
 
The data model for a sectioned table is typically an array of dictionaries. Each dictionary represents a section. Each section dictionary has a title and an array of dictionaries. Each of these dictionaries represents a row.

If you need custom cells then each kind of cell should have a different CellIdentifier.

There's nothing in your description of what you want to do that is different between grouped tables and plain tables.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.