Santosh Gurram
Santosh Gurram

Reputation: 1017

How to form a grid using UITableview?

I am working on TV guide project, I want to know how to form a grid i.e I want to split the cells and construct it just like a grid. I know that I have to use UITableview, but I want to know how to do it.

If any one please provide the concept with sample project or code will be appreciated.

Upvotes: 1

Views: 2291

Answers (4)

bryanjclark
bryanjclark

Reputation: 6404

The Transporter iPhone app does this in a great way; you can check out their code on GitHub here.

Here's what the tableview looks like in their app:

enter image description here

Upvotes: 0

Kyle
Kyle

Reputation: 1672

This sort of project already exists look into AQGridView.

Upvotes: 0

Tark
Tark

Reputation: 5173

I have implemented something like this before, my approach was to subclass UIScrollView and implement some custom view recycling and layout. It was pretty simple to implement, although things got a bit complicated when I started implementing animations. Basically, the idea is to override - (void)layoutSubviews with something like:

- (void)layoutSubviews
{
    [super layoutSubviews];

    CGRect visibleBounds = [self bounds];

    // calculate the range of visible views

    // recycle any no longer visible views

    // for any missing views, request them from the data source        
 }

You will need to implement your own data source and delegate protocols for whatever needs you have, mine were pretty simple.

Upvotes: 0

Bharath
Bharath

Reputation: 73

You can use custom cells, each cell with some around 4 to 5 buttons based on your requirement.

I hope you have idea on creating custom table cells & using them.

providing code is bit clumsy thing here

Upvotes: 1

Related Questions