Navigating the Calendar
Send Feedback

Glossary Item Box

Topic Overview

Purpose

This topic provides an introductory overview of navigating the IGCalendarView™ control and demonstrates how to configure it using a code example.

In this topic


Introduction

Navigation summary

The IGCalendarView is simple to navigate, whether programmatically or using interaction through the year, month and day views.

  • Year View - Tapping a month while on the year view navigates to that month, while Scrolling vertically navigates through the years
  • Month View - Tapping on a day in the month view navigates to that day, while Scrolling vertically navigates through the months and increases or decreases the year depending on the whether you are scrolling forwards or backwards through time.
  • Day View - Tapping on any number day in the day view to navigate to that day, or scroll by a week, by panning left or right
Note: Day view navigation is horizontal; flat.

IGCalendarViewDelegate provides methods for intercepting the year and month navigation. Returning YES on these methods accepts navigation, whereas NO cancel the navigation.

  • calendarView:yearViewMonthTapped:
  • calendarView:monthViewDayTapped:

Navigating the calendar is also possibly through methods available on the calendar.

  • navigateToDate:forType: - This method takes an NSDate and navigates to it and if possible will animate into the supplied IGCalendarViewDisplayType; IGCalendarViewDisplayTypeYear, IGCalendarViewDisplayTypeMonth or IGCalendarViewDisplayTypeDay. If animating into view is not possible, the calendar will snap into the view
  • navigateBack – This method navigates back to a month view from a day view, or conversly back to a year view from a month view. Calling the method while in year view, results in nothing occuring

Additionally, there are properties for obtaining information about the current calendar view and date.

  • currentDate (read only) – Returns an NSDate representing a date based on your current view.
    • In year view, currentDate returns January 1st of the year you are currently in
    • In month view, currentDate l returns the 1st of the month you are viewing in the year you are
    • In day view, currentDate returns the month, day and year you are viewing
  • calendarType (read only) – Returns the view you are currently in; IGCalendarViewDisplayTypeYear, IGCalendarViewDisplayTypeMonth or IGCalendarViewDisplayTypeDay

Navigation views

The following table illustrates the typical representation of the year, month and day views that can be navigated to through interaction or programmatically.

Calendar View

Preview

Year View

Month View

Day View



Navigating the Calendar – Code Example

Description

The code below creates an instance of the IGCalendarView and navigates it to the day view of the current date.

Prerequisites

This code example requires the inclusion of the IG framework, detail about how to add this framework can be found in the Adding the IG Framework File topic.

Code

In Objective-C:

IGCalendarView *calendar = [[IGCalendarView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:calendar];
[calendar navigateToDate:[NSDate date] forType:IGCalendarViewDisplayTypeDay];

In C#:

IGCalendarView calendar = new IGCalendarView ();
calendar.Frame = this.View.Bounds;
this.View.Add (calendar);
calendar.Navigate (NSDate.Now, IGCalendarViewDisplayType.IGCalendarViewDisplayTypeDay);

Related Content

Topics

The following topic provides additional information related to this topic.

Topic

Purpose

The topics in this group cover enabling, configuring, and using the IGCalendarView control’s supported features.