Описание: пользовательская ячейка электронной таблицы, унаследованная от класса NuGridImageTextCell.
#import <NuGridView/NuGridView.h> #import <NuGridView/NuGridExpandableCell.h> #import "LinearGradientBrush.h" #import "RadialGradientBrush.h" #import "GradientStop.h" @interface CustomCell : NuGridExpandableCell @property(assign) NuGridBrush *brush; // Кисть для заливки ячеек таблицы @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) {
// Выключаем режим сворачивания строки
[self setIsExpandableRow:NO];
// Выключаем режим сворачивания столбца
[self setIsExpandableColumn:NO];
}
return self;
}
- (void)drawRect:(CGRect)rect
{
[super drawRect:rect];
if([self brush] != nil) {
// Выполняем заливку ячейки указанной кистью
CGRect bounds = rect;
CGContextRef context = UIGraphicsGetCurrentContext();
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddRect(path, nil, bounds);
[[self brush] applyToContext:context path:path rect:bounds];
CGPathRelease(path);
}
}
@end
См. также: