Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
ScheduleViewController is ready to display schedule data in its table. We need to modify RootViewController to obtain the schedule data and then cue ScheduleViewController to display it.
In RootViewController.m, import ScheduleFetcher.h and ScheduleViewController.h, and set the title of the navigation item:
#import "RootViewController.h"
#import "ScheduleFetcher.h"
#import "ScheduleViewController.h"
@implementation RootViewController
- (id)initWithNibName:(NSString *)nibNameOrNil
bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
[[self navigationItem] setTitle:@"Ranch Forecast"];
}
return self;
}
Now we are ready to fill in the code for the fetchClasses: action. We will use ScheduleFetcher, which we copied directly from the Cocoa version of this application, to obtain the results. The block we supply will be called once the results have been received or if an error has occurred. If we receive the schedule, we will create a new instance of ScheduleViewController and push it onto the navigation controller’s stack, thus presenting it to the user. If an error occurs, we will display an alert.