#import "RootViewController.h" #import "SimpleTableViewAppDelegate.h" @implementation RootViewController - init { if (self = [super init]) { self.title = NSLocalizedString(@"Time Zones", @"Time Zones title"); } return self; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Only one section return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of time zone names SimpleTableViewAppDelegate *appDelegate = (SimpleTableViewAppDelegate *)[[UIApplication sharedApplication] delegate]; return [appDelegate countOfList]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"MyIdentifier"] autorelease]; } // Set up the cell SimpleTableViewAppDelegate *appDelegate = (SimpleTableViewAppDelegate *)[[UIApplication sharedApplication] delegate]; NSString *timeZoneName = [appDelegate objectInListAtIndex:indexPath.row]; cell.text = timeZoneName; return cell; } @end