Description: a data grid custom cell inherited from the NuGridImageTextCell class.
#import <NuGridView/NuGridView.h> #import <NuGridView/NuGridExpandableCell.h> #import "LinearGradientBrush.h" #import "RadialGradientBrush.h" #import "GradientStop.h" @interface CustomCell : NuGridExpandableCell @property(assign) NuGridBrush *brush; // Brush for table cell fill @end
#import "CustomCell.h"
#import <NuGridView/NuGridSolidColorBrush.h>
#import <NuGridView/NuGridGradientBrush.h>
#import <NuGridView/NuGridRadialGradientBrush.h>
@implementation CustomCell
@synthesize brush = _brush;
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Disable row collapse mode
[self setIsExpandableRow:NO];
// Disable column collapse mode
[self setIsExpandableColumn:NO];
}
return self;
}
- (void)drawRect:(CGRect)rect
{
[super drawRect:rect];
if([self brush] != nil) {
// Fill cell with specified brush
CGRect bounds = rect;
CGContextRef context = UIGraphicsGetCurrentContext();
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddRect(path, nil, bounds);
[[self brush] applyToContext:context path:path rect:bounds];
CGPathRelease(path);
}
}
@end
See also: