project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.m
branchios-revival
changeset 11217 e68b3e392091
parent 10108 c68cf030eded
child 11229 b49dfdf628f6
--- a/project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.m	Sat Oct 17 20:07:10 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.m	Mon Oct 19 03:39:47 2015 +0200
@@ -131,42 +131,42 @@
 
 #pragma mark -
 #pragma mark Table view delegate
--(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
-    if (childController == nil) {
-        childController = [[SingleWeaponViewController alloc] initWithStyle:UITableViewStyleGrouped];
-    }
+-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    SingleWeaponViewController *singleWeaponViewController = [[SingleWeaponViewController alloc] initWithStyle:UITableViewStyleGrouped];
 
     NSInteger row = [indexPath row];
     NSString *selectedWeaponFile = [self.listOfWeapons objectAtIndex:row];
 
     // this must be set so childController can load the correct plist
-    childController.weaponName = [selectedWeaponFile stringByDeletingPathExtension];
-    [childController.tableView setContentOffset:CGPointMake(0,0) animated:NO];
+    singleWeaponViewController.weaponName = [selectedWeaponFile stringByDeletingPathExtension];
+    [singleWeaponViewController.tableView setContentOffset:CGPointMake(0,0) animated:NO];
 
-    [self.navigationController pushViewController:childController animated:YES];
+    [self.navigationController pushViewController:singleWeaponViewController animated:YES];
+    [singleWeaponViewController release];
+    
     [tableView deselectRowAtIndexPath:indexPath animated:YES];
 }
 
 
 #pragma mark -
 #pragma mark Memory management
--(void)didReceiveMemoryWarning {
+-(void)didReceiveMemoryWarning
+{
     [super didReceiveMemoryWarning];
-    if (childController.view.superview == nil )
-        childController = nil;
 }
 
--(void) viewDidUnload {
+-(void) viewDidUnload
+{
     self.listOfWeapons = nil;
-    childController = nil;
     MSG_DIDUNLOAD();
     [super viewDidUnload];
 }
 
 
--(void) dealloc {
+-(void) dealloc
+{
     releaseAndNil(listOfWeapons);
-    releaseAndNil(childController);
     [super dealloc];
 }