views:

286

answers:

1

I am currently trying to implement a grid view in the iPhone SDK, whereby in portrait mode there are 2 items wide and in landscape mode there are 3. I am implementing this using a UITableView as suggested here.

What is the best way to change the number of rows and the view of the UITableViewCell with device rotation?

If anyone knows a good link to a tutorial about custom UITableViewCell rotation then that would be great.

Cheers

+1  A: 

Start with the basics!

You can detect the orientation change in your view controller using this:

- (void)willRotateToInterfaceOrientation: (UIInterfaceOrientation)toInterfaceOrientation
                                duration: (NSTimeInterval)duration

In that, you can just recalculate how many pictures to show per row and call reloadData on your table. (Your table data source message handlers need to respect the pictures per row, of course.)

Steven Fisher