Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
56 lines (35 sloc) 1.85 KB

<img src="http://office.nousguide.com/nouslogosmall.png" alt="NOUSguide Inc." title="NOUSguide Inc." title" style="display:block; margin: 10px auto 30px auto;" class="center">

NGVaryingGridView

A GridView which allows to set individual Rects for the Cells. So you can define Cells with different Sizes, used e.g. in Timetables, EPGs, etc.

Sticky Views are also supported on top of the GridView and on the left side.

<img src="http://office.nousguide.com/github/NGVaryingGridView.png" alt="NGVaryingGridView" title="NGVaryingGridView" title" style="display:block; margin:20px;" class="center">

Usage

self.gridView = [[NGVaryingGridView alloc] initWithFrame:self.view.bounds];
self.gridView.gridViewDelegate = self;
[self.view addSubview:self.gridView];

[self.gridView reloadData];

The following Delegate-Methods are required:

// You should return an Array which contains CGRects for every Cell you want to display inside the GridView
- (NSArray *)rectsForCellsInGridView:(NGVaryingGridView *)gridView {
	NSMutableArray *rectsArray = [NSMutableArray array];
	[array addObject:[NSValue valueWithCGRect:CGrectMake(...)]]
	
	// ...
	
	return rectsArray;
}

// return an UIView representing your Cell
- (UIView *)gridView:(NGVaryingGridView *)gridView viewForCellWithRect:(CGRect)rect index:(NSUInteger)index {
	YourUIViewSubclass *gridCell = (YourUIViewSubclass *)[gridView dequeueReusableCell] ? : [[YourUIViewSubclass alloc] initWithFrame:rect];
	gridCell.frame = rect;
	
	// setup gridCell
	
	return gridCell
}

Just have a look inside the provided Demo-Application.

Credits

NGVaryingGridView was created by Philip Messlehner

License

NGPageControl is available under the MIT license. See the LICENSE file for more info. For usage without attribution contact NOUSguide.