Inherits from NSObject
Conforms to TKLayout
Declared in TKGridLayout.h

Overview

A class that is able to arrange views in grid layout.

Properties

arrangedViews

An array containing the views that will be layed out.

@property (nonatomic, strong, readonly) NSArray *arrangedViews

Declared In

TKGridLayout.h

definitions

An array containt cell definitions for the views that will be layed out.

@property (nonatomic, strong, readonly) NSArray *definitions

Declared In

TKGridLayout.h

frame

The rect in which the views will be arranged.

@property (nonatomic) CGRect frame

Declared In

TKGridLayout.h

horizontalSpacing

Horizontal spacing between the views.

@property (nonatomic) CGFloat horizontalSpacing

Declared In

TKGridLayout.h

minColumnsWidth

Minimum width for columns.

@property (nonatomic, strong) NSNumber *minColumnsWidth

Declared In

TKGridLayout.h

minRowsHeight

Minimum height for rows.

@property (nonatomic, strong) NSNumber *minRowsHeight

Declared In

TKGridLayout.h

orientation

Layout’s orientation.

@property (nonatomic) TKLayoutOrientation orientation

Declared In

TKGridLayout.h

verticalSpacing

Vertical spacing between the views.

@property (nonatomic) CGFloat verticalSpacing

Declared In

TKGridLayout.h

Instance Methods

addArrangedView:

Adds arranged view.

- (void)addArrangedView:(UIView *)view

Parameters

view

The view that will be added to the layout.

Declared In

TKGridLayout.h

addDefinition:

Adds cell definition to the layout.

- (void)addDefinition:(TKGridLayoutCellDefinition *)definition

Parameters

definition

The definition that will be added.

Declared In

TKGridLayout.h

addDefinitionForView:atRow:column:rowSpan:columnSpan:

Adds definition for the specified view.

- (TKGridLayoutCellDefinition *)addDefinitionForView:(UIView *)view atRow:(NSNumber *)row column:(NSNumber *)column rowSpan:(NSInteger)rowSpan columnSpan:(NSInteger)columnSpan

Parameters

view

The view for which a definition will be added.

row

The row at wich the view will be layed out.

column

The column at which the view will be layed out.

rowSpan

Row span.

columnSpan

Column span.

Declared In

TKGridLayout.h

arrangeView:withLayoutInfo:

Updates the view with the corresponding layuout info.

- (void)arrangeView:(UIView *)view withLayoutInfo:(TKLayoutInfo *)layoutInfo

Parameters

view

The view that will be arranged.

layoutInfo

The layout info.

Declared In

TKGridLayout.h

definitionForView:

Returns definition for specified view.

- (TKGridLayoutCellDefinition *)definitionForView:(UIView *)view

Parameters

view

The view for which a definition will be returned.

Return Value

Cell definition for the specified view.

Declared In

TKGridLayout.h

initWithFrame:

Instantiates TKGridLayout object.

- (id)initWithFrame:(CGRect)frame

Parameters

frame

The layout’s frame.

Return Value

TKGridLayout instance.

Declared In

TKGridLayout.h

insertArrangedView:atIndex:

Inserts arranged view.

- (void)insertArrangedView:(UIView *)view atIndex:(NSUInteger)index

Parameters

view

The view that will be inserted.

index

The index at which the view will be inserted.

Declared In

TKGridLayout.h

layoutArrangedViews

Lays out the arranged views.

- (void)layoutArrangedViews

Declared In

TKGridLayout.h

measurePreferredSizeThatFitsSize:

Measures the size of the of the arranged views to fit in the specified size.

- (CGSize)measurePreferredSizeThatFitsSize:(CGSize)size

Parameters

size

The size that the views must fit after arrangement.

Return Value

The optimal size to fit the desired size.

Declared In

TKGridLayout.h

removeAllArrangedViews

Removes all arranged views.

- (void)removeAllArrangedViews

Declared In

TKGridLayout.h

removeAllDefinitions

Removes all cell definitions.

- (void)removeAllDefinitions

Declared In

TKGridLayout.h

removeArrangedView:

Removes arranged view.

- (void)removeArrangedView:(UIView *)view

Parameters

view

The view that will be remove.

Declared In

TKGridLayout.h

removeDefinition:

Removes a definition

- (void)removeDefinition:(TKGridLayoutCellDefinition *)definition

Parameters

definition

The definition that will be removed.

Declared In

TKGridLayout.h

resetHeightForRow:

Removes the previously set height for specified row.

- (void)resetHeightForRow:(NSInteger)row

Parameters

row

The row for which height will be reset.

Declared In

TKGridLayout.h

resetWidthForColumn:

Removes the previously set width for specified column.

- (void)resetWidthForColumn:(NSInteger)col

Parameters

col

The column for which width will be reset.

Declared In

TKGridLayout.h

setHeight:forRow:

Sets height for specified row.

- (void)setHeight:(CGFloat)height forRow:(NSInteger)row

Parameters

height

The height to be set.

row

The row for which height will be set.

Declared In

TKGridLayout.h

setWidth:forColumn:

Sets width for specified column.

- (void)setWidth:(CGFloat)width forColumn:(NSInteger)col

Parameters

width

The width to be set.

col

The column for which width will be set.

Declared In

TKGridLayout.h