Inherits from NSObject
Conforms to NSCoding
Declared in IGGridViewColumnDefinition.h

Overview

IGGridViewColumnDefinition is an object that is used by the IGGridViewDataSourceHelper classes to identify properties on the underlying data objects.

For example, if I had an array of objects of type MyClass. And MyClass had three properties: firstName, lastName and age. I could create a column definition for my firstName property:

colDef = [[IGGridViewColumnDefinition alloc] initWithKey:@"firstName"];

colDef.headerText = "@First Name";

The real benefits of using column definitions comes with the ability to create your own derived versions that override the gridView:createCell:usingDataSource: method. By doing so, you can specify any custom cell that you want to display in the column. For example: the IGGridViewImageColumnDefinition creates a column that uses the IGGridViewImageCell.

Note: when deriving your own column defition, you should follow the same practice of using the grid view’s dequeueReusableCellWithIdentifier: method.

Tasks

Configuring the Column Definition

Protected Members

Properties

backgroundColor

The background color for every cell in the column.

@property (nonatomic, retain) UIColor *backgroundColor

Declared In

IGGridViewColumnDefinition.h

fieldKey

The name of the property that this column definition represents (readonly)

@property (nonatomic, retain, readonly) NSString *fieldKey

Declared In

IGGridViewColumnDefinition.h

headerText

The value that should be display in the header of the IGGridView for this column.

@property (nonatomic, retain) NSString *headerText

Declared In

IGGridViewColumnDefinition.h

textAlignment

The alignment of the text field.

@property (nonatomic, assign) UITextAlignment textAlignment

Declared In

IGGridViewColumnDefinition.h

textColor

The font color of the text field.

@property (nonatomic, retain) UIColor *textColor

Declared In

IGGridViewColumnDefinition.h

textFont

The font of the text field.

@property (nonatomic, retain) UIFont *textFont

Declared In

IGGridViewColumnDefinition.h

width

The width of the column. The default is nil.

@property (nonatomic, retain) IGColumnWidth *width

Discussion

Note: This has lower priority than if the delegate specifies the width for the column.

Declared In

IGGridViewColumnDefinition.h

Instance Methods

applyStylingToCell:AtRow:inGrid:

Call this from a derived class to ensure the proper styling is applied to your cell.

- (void)applyStylingToCell:(IGGridViewCell *)cell AtRow:(int)rowIndex inGrid:(IGGridView *)gridView

Parameters

cell

The cell that should be updated.

gridView

The gridView that the cell belongs to.

rowInex

The index of the row for the cell beging updated.

Declared In

IGGridViewColumnDefinition.h

gridView:createCell:usingDataSource:

Asks the column definition for a cell to place at a particular location in the grid view.

- (IGGridViewCell *)gridView:(IGGridView *)gridView createCell:(IGCellPath *)path usingDataSource:(IGGridViewDataSourceHelper *)dataSource

Parameters

gridView

The grid view requesting the cell.

path

The path of the cell that is needed

dataSource

The IGGridViewDataSourceHelper that has invoked this method.

Return Value

An object inheriting IGGridViewCell that the grid view can use for the specified location.

Discussion

The returned IGGridViewCell object is frequently one that the application reuses for performance reasons. You should fetch a previously created cell object that is marked for reuse by sending a dequeueResuableCellWithIdentifier: message to the grid view. The identifier for a reusable cell object is assigned when the the initWithStyle:reuseIdentifier: method of the IGGridViewCell.

Declared In

IGGridViewColumnDefinition.h

initWithKey:

Creates an IGGridViewColumnDefinition for the specified property name.

- (id)initWithKey:(NSString *)key

Parameters

key

A string that maps to an actual property on your underlying data object.

Return Value

Returns an initialized IGGridViewColumnDefinition object or nil if the object could not be successfully initialized.

Declared In

IGGridViewColumnDefinition.h

setText:onCell:forDataSource:

Sets the text provided to the cell’s text label.

- (void)setText:(NSString *)text onCell:(IGGridViewCell *)cell forDataSource:(IGGridViewDataSourceHelper *)dataSource

Parameters

text

The text to be set on the cell.

cell

The cell that should be updated.

dataSource

The datasource being used.

Discussion

This method allows a cell to be updated properly. Especially if there is a filter applied and a special string attributes such as font color should be applied to the cell’s text.

Declared In

IGGridViewColumnDefinition.h