// // TestEntriesViewController.m // Box2D // // Box2D iPhone port by Simon Oliver - http://www.simonoliver.com - http://www.handcircus.com // #import "TestEntriesViewController.h" @implementation TestEntriesViewController @synthesize delegate=_delegate; - (id)initWithStyle:(UITableViewStyle)style { if (self = [super initWithStyle:style]) { testCount = 0; TestEntry* e = g_testEntries; while (e->createFcn) { ++testCount; ++e; } } return self; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview // Release anything that's not essential, such as cached data } #pragma mark Table view methods - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } // Customize the number of rows in the table view. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return testCount; } // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; } // Set up the cell... TestEntry* e = g_testEntries; e+=indexPath.row; cell.textLabel.text = [NSString stringWithUTF8String:e->name]; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [_delegate selectTest:indexPath.row]; } - (void)dealloc { [super dealloc]; } @end