UIGridView offers a simple way to use a grid (multiple-column UITableView) on iOS
Objective-C
Switch branches/tags
Nothing to show
Latest commit b8311ef Aug 14, 2012 4 Tanin Na Nakorn Update README.md

README.md

UIGridView (iOS = iPhone/iPad)

UIGridView offers a simple way to build a grid (multiple-column UITableView).

It supports:

  • Adjust the width of a column (individually)
  • Adjust the height of a row (individually)
  • Click event on a cell
  • Customize cell

Here is how it looks like:

UIGridView Example

How to use it

  1. Include /Classes/UIGridView/* into your project
  2. Setup the delegate uiGridViewDelegate of UIGridView; Methods that shall be implemented are shown below:
- (CGFloat) gridView:(UIGridView *)grid widthForColumnAt:(int)columnIndex
{
	return 80;
}

- (CGFloat) gridView:(UIGridView *)grid heightForRowAt:(int)rowIndex
{
	return 80;
}

- (NSInteger) numberOfColumnsOfGridView:(UIGridView *) grid
{
	return 4;
}


- (NSInteger) numberOfCellsOfGridView:(UIGridView *) grid
{
	return 33;
}

- (UIGridViewCell *) gridView:(UIGridView *)grid cellForRowAt:(int)rowIndex AndColumnAt:(int)columnIndex
{
	Cell *cell = (Cell *)[grid dequeueReusableCell];
	
	if (cell == nil) {
		cell = [[Cell alloc] init];
	}
	
	cell.label.text = [NSString stringWithFormat:@"(%d,%d)", rowIndex, columnIndex];
	
	return cell;
}

- (void) gridView:(UIGridView *)grid didSelectRowAt:(int)rowIndex AndColumnAt:(int)colIndex
{
	NSLog(@"%d, %d clicked", rowIndex, colIndex);
}

Author

Tanin Na Nakorn

License

Do What The Fuck You Want To Public License (http://sam.zoy.org/wtfpl/)

  1. You just DO WHAT THE FUCK YOU WANT TO.