# HG changeset patch # User koda # Date 1320293739 -3600 # Node ID 57523ab57218e02ed95c9c5d452e55f6b7b66fa7 # Parent d773867f93db19cd9429a50cc4460c154e328ff4 small tweak to ingamemenu class diff -r d773867f93db -r 57523ab57218 project_files/HedgewarsMobile/Classes/InGameMenuViewController.h --- a/project_files/HedgewarsMobile/Classes/InGameMenuViewController.h Thu Nov 03 05:09:05 2011 +0100 +++ b/project_files/HedgewarsMobile/Classes/InGameMenuViewController.h Thu Nov 03 05:15:39 2011 +0100 @@ -23,10 +23,9 @@ @interface InGameMenuViewController : UITableViewController { - NSArray *menuList; + } -@property (nonatomic,retain) NSArray *menuList; -(void) present; -(void) dismiss; diff -r d773867f93db -r 57523ab57218 project_files/HedgewarsMobile/Classes/InGameMenuViewController.m --- a/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m Thu Nov 03 05:09:05 2011 +0100 +++ b/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m Thu Nov 03 05:15:39 2011 +0100 @@ -29,41 +29,12 @@ #define VIEW_HEIGHT 200 @implementation InGameMenuViewController -@synthesize menuList; -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { return rotationManager(interfaceOrientation); } --(void) didReceiveMemoryWarning { - self.menuList = nil; - [super didReceiveMemoryWarning]; -} - --(void) viewDidLoad { - NSArray *array = [[NSArray alloc] initWithObjects: - NSLocalizedString(@"Show Help", @""), - NSLocalizedString(@"Tag", @""), - NSLocalizedString(@"End Game", @""), - nil]; - self.menuList = array; - [array release]; - - [super viewDidLoad]; -} - --(void) viewDidUnload { - self.menuList = nil; - MSG_DIDUNLOAD(); - [super viewDidUnload]; -} - --(void) dealloc { - releaseAndNil(menuList); - [super dealloc]; -} - #pragma mark - #pragma mark animating -(void) present { @@ -103,12 +74,21 @@ -(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellIdentifier = @"CellIdentifier"; + NSInteger row = [indexPath row]; + NSString *cellTitle; + if (row == 0) + cellTitle = NSLocalizedString(@"Show Help", @""); + else if (row == 1) + cellTitle = NSLocalizedString(@"Tag", @""); + else + cellTitle = NSLocalizedString(@"End Game", @""); + UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (nil == cell) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease]; } - cell.textLabel.text = [self.menuList objectAtIndex:[indexPath row]]; + cell.textLabel.text = cellTitle; if (IS_IPAD()) cell.textLabel.textAlignment = UITextAlignmentCenter;