All pastes #994062 Raw Edit

Stuff

public text v1 · immutable
#994062 ·published 2008-04-23 02:24 UTC
rendered paste body
#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