Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 30. Developing for iOS > Pushing View Controllers

Pushing View Controllers

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.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial