Ячейка с текстом и изображением в простой электронной таблице

Описание: пользовательская ячейка электронной таблицы, унаследованная от класса NuGridImageTextCell.

Файл «CustomCell.h»

#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

Файл «CustomCell.m»

#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

См. также:

Создание простой электронной таблицы