Inherits from NSObject
Declared in SGridCoord.h
Availability
Related samples

Overview

A SGridCoord object represents the position of a given SGridCell object within the parent ShinobiGrid object.

A grid coord is of the form {colIndex, row}, where colIndex is an int that represents the column of the coordinate and row is a struct that represents the row of the coordinate. This struct is of type SGridRow as follows:

    typedef struct {
        NSInteger index;
        NSInteger section;
    } SGridRow;

The SGridRow type therefore represents a row in a grid by representing the section that the row belongs to and the index of the row within that section.

Columns, rows and sections are zero-indexed. For example the first (top left) cell of the grid will have a column of 0, row of 0 and a section of 0.

Tasks

Initializing a SGridCoord Object

Identifying and Comparing SGridCoord Objects

  • – isEqual:

    Returns YES if the parameter object is of type SGridCoord and has column and row properties that match the values of this SGridCoord object.

  • – hasSection:

    A convenienve method to allow for the identification of cells/gridcoors that reside within a particular section.

  • – hasColumn:

    A convenience method to allow for the identification of cells/grid coordinates that reside within a particular column.

  • – hasRow:

    A convenience method to allow for the identification of cells/grid coordinates that reside within a particular row.

  • – hasColumn:andRow:

    A convenience method to allow for the identification of a cell/gridcoord at a particular column and row within a particular section.

  • – hasColumn:orRow:

    A convenience method to allow for the identification of a cell/gridcoord that belongs to a particular row or column.

  • – hasRowGreaterThanRow:

    A convenience method in order to check if this grid coord has a row that is greater (physically lower in the grid) that the parameter row.

  • – column

    Returns the index of the column that this grid coord object represents.

  • – row

    Returns the struct of type Row that represents the index and section of the row that this grid coord represents.

  • – rowIndex

    Returns the index of the row that this grid coord belongs to (note that this does not inform you of the section that the row belongs to).

  • – section

    Returns the index of the section that this grid coord object belongs to.

Instance Methods

column

Returns the index of the column that this grid coord object represents.

- (NSInteger)column

Declared In

SGridCoord.h

hasColumn:

A convenience method to allow for the identification of cells/grid coordinates that reside within a particular column.

- (BOOL)hasColumn:(NSInteger)colToCheck

Parameters

colToCheck

The index of the column to be checked.

Return Value

YES if colIndex is equal to this this grid coord’s column property

Declared In

SGridCoord.h

hasColumn:andRow:

A convenience method to allow for the identification of a cell/gridcoord at a particular column and row within a particular section.

- (BOOL)hasColumn:(NSInteger)colToCheck andRow:(SGridRow)rowToCheck

Parameters

colToCheck

The index of the column to be checked.

rowToCheck

The row to be checked.

Return Value

YES if rowToCheck and colToCheck are equal to this object’s row and column properties.

Declared In

SGridCoord.h

hasColumn:orRow:

A convenience method to allow for the identification of a cell/gridcoord that belongs to a particular row or column.

- (BOOL)hasColumn:(NSInteger)colToCheck orRow:(SGridRow)rowToCheck

Parameters

colToCheck

The index of the column to be checked.

rowToCheck

The row to be checked.

Return Value

YES if rowToCheck or colToCheck is equal to the correspoinding row or column property of this object.

Declared In

SGridCoord.h

hasRow:

A convenience method to allow for the identification of cells/grid coordinates that reside within a particular row.

- (BOOL)hasRow:(SGridRow)rowToCheck

Parameters

rowToCheck

The index of the row to be checked.

Return Value

YES if rowIndex is equal to this this object’s row property

Declared In

SGridCoord.h

hasRowGreaterThanRow:

A convenience method in order to check if this grid coord has a row that is greater (physically lower in the grid) that the parameter row.

- (BOOL)hasRowGreaterThanRow:(SGridRow)rowToCheck

Parameters

rowToCheck

The row that this grid coord’s row will be checked against.

Return Value

YES if rowToCheck is less than (physically higher in the grid) than this grid coordinates row property.

Declared In

SGridCoord.h

hasSection:

A convenienve method to allow for the identification of cells/gridcoors that reside within a particular section.

- (BOOL)hasSection:(NSInteger)sectionToCheck

Return Value

YES if sectionIndex is equal to this grid coord’s section property.

Discussion

@param sectionToCheck

Declared In

SGridCoord.h

initWithColumn:withRow:

Creates and returns a SGridCoord object that is located at {colIndex, rowIndex, sectionIndex}.

- (id)initWithColumn:(NSInteger)colIndex withRow:(SGridRow)row

Parameters

colIndex

The column that this grid coord will point to.

row

The row that this grid coord will point to (contains the section and row of that section).

Declared In

SGridCoord.h

isEqual:

Returns YES if the parameter object is of type SGridCoord and has column and row properties that match the values of this SGridCoord object.

- (BOOL)isEqual:(id)object

Parameters

object

The object to test for equality with this SGridCoord object.

Return Value

YES if object is of type SGridCoord and has matching col, row and section values.

Declared In

SGridCoord.h

row

Returns the struct of type Row that represents the index and section of the row that this grid coord represents.

- (SGridRow)row

Declared In

SGridCoord.h

rowIndex

Returns the index of the row that this grid coord belongs to (note that this does not inform you of the section that the row belongs to).

- (NSInteger)rowIndex

Declared In

SGridCoord.h

section

Returns the index of the section that this grid coord object belongs to.

- (NSInteger)section

Declared In

SGridCoord.h