Enabling and Configuring the Shortcut Bar
Send Feedback

Glossary Item Box

Topic Overview

Purpose

This topic provides a conceptual overview, with code, on enabling and configuring the shortcut bar 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


Introduction

Shortcut bar summary

The shortcut bar is a quick and easy way of navigating through a lot of data. Achieved by presenting a bar along the right side of the IGGridView for users to press the section name, navigating instantly to the section. To enable the shortcut bar, the IGGridViewDataSource protocol has 2 methods that must be implemented.

  • -(NSArray *)sectionIndexTitlesForGridView:(IGGridView *)gridView;
  • -(NSInteger)gridView:(IGGridView *)gridView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index;

The sectionIndexTitlesForGridView method provides an array of strings displayed in the shortcut bar. The second required method, sectionForSectionIndexTitle, tells the IGGridView what section it should navigate to when the following item is pressed on the shortcut bar.

The shortcut bar has additional properties found on the IGGridView that allow for further customization.

  • shortcutBarColor – background color of the shortcut bar.
  • shortcutBarColumnWidth – width of the shortcut bar column.
  • shortcutBarColumnBackgroundView – custom UIView to represent the background of the shortcut bar.

Implementation of the Shortcut Bar – Code Example

Description

The following code implements the sectionIndexTitlesForGridView and sectionForSectionIndexTitle methods required for the shortcut bar. The shortcut bar contains the letters A through D (sectionIndexTitlesForGridView), and when the user presses a letter, the IGGridView navigates to the associated grid section (sectionForSectionIndexTitle).

Code

In Objective-C:

- (NSArray *)sectionIndexTitlesForGridView:(IGGridView *)gridView
{
       return [NSArray arrayWithObjects:@"A", @"B", @"C", @"D", nil];
}
- (NSInteger)gridView:(IGGridView *)gridView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index
{
    return index;
}

In C#:

public override NSObject[] SectionIndexTitles(IGGridView gridView)
{
   return new NSObject[]{new NSString("A"), new NSString("B"), new NSString("C"), new NSString("D")};
}
 

public override int GetSectionForTitleAtIndex(IGGridView gridView, string title, int index)
{
   return index;
}


Related Content

Topics

The following topics provide additional information related to this topic.

Topic

Purpose

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.