TestEntriesViewController.mm
上传用户:gb3593
上传日期:2022-01-07
资源大小:3028k
文件大小:2k
源码类别:
游戏引擎
开发平台:
Visual C++
- //
- // 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 setText:[NSString stringWithCString:e->name]];
- return cell;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- [_delegate selectTest:indexPath.row];
- }
- - (void)dealloc {
- [super dealloc];
- }
- @end