1

I have seen apps that have table views that have rows that contain 2 or 3 cells. Something like the following:

| 3 cells in one row        |

/-------\ /-------\ /-------\
|do this| |  do   | |do smth|   <--- table view row that contains 3 cells
|       | | that  | | else  |
\-------/ \-------/ \-------/

When you click on a cell they behave exactly like a cell and have different events. Is there a simple way to do this or do I have to use some trick.

gyozo kudor
  • 6,284
  • 10
  • 53
  • 80

3 Answers3

5

Those aren't actually separate cells. A UITableView can only contain rows, not columns. But each cell can be laid out with its content in three equal-sized areas, thereby mimicking a real grid of content.

Dan Ray
  • 21,623
  • 6
  • 63
  • 87
4

If they don't have to look like cells, I would use 3 Buttons in a custom UITableViewCell. They also get blue if you tap on them.

Sandro Meier
  • 3,071
  • 2
  • 32
  • 47
  • Adding buttons seems ok but I don't know if I can make the container cell have transparent background so the buttons look like real cells. Gonna try out. – gyozo kudor Jul 19 '10 at 12:51
  • Ah you want them to look real. Than I've another Idea. Try to place 3 UITableviews side by side and synchronize their movement. ;-) – Sandro Meier Jul 19 '10 at 13:22
  • Tables and table cells can have transparent backgrounds, at the expense of scrolling performance. – tc. Jul 19 '10 at 17:54
0

Adding buttons and then using the code from here seems to be the easiest way. Although the initWithFrame:CGRectZero looks hacky, it works.

Community
  • 1
  • 1
gyozo kudor
  • 6,284
  • 10
  • 53
  • 80