Displaying Sections and Section Columns
Send Feedback

Glossary Item Box

Topic Overview

Purpose

This topic provides a conceptual overview, with code, on displaying sections and section columns on the IGGridView™ control.

Required background

The following table lists the topics required as a prerequisite to understanding this topic.

Topic

Purpose

Adding the Grid Framework File

This topic explains the requirements for adding the grid framework file to an Xcode project; a requirement for using the IGGridView control.


In this topic

This topic contains the following sections:


Introduction

Sections summary

The IGGridView allows displayed data to be grouped together into sections. The IGGridViewDataSource has three methods that make the implementation of sections quick and easy.

  • -(int) numberOfSectionsInGridView:(IGGridView *)gridView;
  • -(NSString*)gridView:(IGGridView*)gridView titleForHeaderInSection:(int)section;
  • -(NSString*)gridView:(IGGridView*)gridView titleForFooterInSection:(int)section;

The numberOfSectionsInGridView allows you to tell the IGGridView how many sections you want displayed, while the other two methods titleForHeaderInSection and titleForFooterInSection, allow you to display a string in the header and footer. No representation for a particular section will be displayed if titleForHeaderInSection or titleForFooterInSection was not implemented or their method’s return value is nil.

To display more than text in a section header or footer the IGGridView control comes with two delegate methods, which allow for complete customization.

  • -(UIView*)gridView:(IGGridView*)gridView viewForHeaderInSection:(int)section;
  • -(UIView*)gridView:(IGGridView*)gridView viewForFooterInSection:(int)section;

These methods are used to display a custom view in the section header or footer. When using a custom view, you may want to adjust the size of the header or footer. This is done by using the sectionHeaderHeight and sectionFooterHeight found on the IGGridView. If the header and footer sizes will vary, there are two methods found on the IGGridViewDelegate that allow for customizing the specific height for each header and footer.

  • -(CGFloat)gridView:(IGGridView*)gridView heightForHeaderInSection:(int)section;
  • -(CGFloat)gridView:(IGGridView*)gridView heightForFooterInSection:(int)section;

Section Columns

Section columns summary

Sections have an additional visual element that displays a fixed content column for each section. For example, if you create a music application that groups songs in sections by album, you could use the section column to display album art. To display the section column implement the follow delegate method.

  • -(UIView *)gridView:(IGGridView *)gv viewForSectionColumn:(int)section

To customize the width of the section column, the property sectionColumnWidth found on the IGGridView can be used. Additionally, if you want to control the background color or what’s displayed in the background of the section column, you can specify a custom view using the IGGridView’s sectionColumnBackgroundView property.


Related Content

Topics

The following topics provide additional information related to this topic.

Topic

Purpose

This topic explains the requirements for adding the grid framework file to an Xcode project; a requirement for using the IGGridView™ control.

This topic provides basic information about creating an instance of the IGGridView and displaying data to help you with getting up and running with using the control.

This section serves as an introduction to the IGGridView’s key features and functionalities.