Daniel
Daniel

Reputation: 23359

grouped UITableView to generate block rows

I want each row of my table view to appear, as it's own independent block, a little like how the Twitter app has on the Discover section (they have the top 3 trending word as 3 blocks.

I am trying to recreate this and the route I am trying to go down is having my table as a grouped tableview but instead of treating each row as a row of one section, I will treat a row as a section, thus generating blocks, each block will have only 1 row.

It sounds like a hack, I'm sure it's not the way to be doing it, but can anyone lend some tips about this kind of setup ?

Also I am using NSFetchedResultsController and I need to specify I want my objects ordered by date, but the section be defined by a unique id which would allow me to generate a section per row. I am not getting any luck with my fetch request either, so I guess this is 2 questions.

Although if I am wrong with the first part, the second becomes irrelevant.

Thank you.

Upvotes: 0

Views: 128

Answers (2)

Daniel
Daniel

Reputation: 23359

The design of the Twitter "blocks" suggest a grouped table view, in fact I did manage to achieve this with a plain table view I just needed to be careful with the borders and background colours behind the cells...

Upvotes: 1

Mundi
Mundi

Reputation: 80273

I would not do it this way. Looking at the Twitter app, I have no doubt that this is a grouped table view, and the block sections use the first row as the title and a second row with a bigger row height for the content.

You can adjust the sections and rows as needed in the table view datasource methods, based on what comes back from the NSFetchedResultsController. Only caveat is that you have to be careful when you use the index path to refer to the core data objects.

Upvotes: 1

Related Questions