Files
DarkRP2D/external/Box2D-2.3.1/Contributions/Platforms/iPhone/Classes/TestEntriesViewController.mm
Julian Nießner d175d433a8 Added Box2D
2018-05-06 12:43:20 +02:00

76 lines
1.7 KiB
Plaintext

//
// 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