- Big refactoring of front-end Settings for both iPhone and iPad: ios-revival
authorantonc27 <antonc27@mail.ru>
Mon, 19 Oct 2015 03:39:47 +0200
branchios-revival
changeset 11221 e68b3e392091
parent 11220 76fd61a88c1e
child 11222 08f20ffa5801
- Big refactoring of front-end Settings for both iPhone and iPad: - - Fixed crash when receiving Memory Warning after dismissing Settings on iPhone - - Set ARC flags for MGSplitVCs as it now updated for iOS 8 - - All sub-settings VCs now recreated each time they presented - - SettingsContainerViewController removed - - Other small improvements
project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.h
project_files/HedgewarsMobile/Classes/LevelViewController.m
project_files/HedgewarsMobile/Classes/MGSplitViewController/MGSplitCornersView.m
project_files/HedgewarsMobile/Classes/MGSplitViewController/MGSplitDividerView.m
project_files/HedgewarsMobile/Classes/MGSplitViewController/MGSplitViewController.m
project_files/HedgewarsMobile/Classes/MainMenuViewController.m
project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.h
project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.m
project_files/HedgewarsMobile/Classes/SettingsBaseViewController.h
project_files/HedgewarsMobile/Classes/SettingsBaseViewController.m
project_files/HedgewarsMobile/Classes/SettingsContainerViewController.h
project_files/HedgewarsMobile/Classes/SettingsContainerViewController.m
project_files/HedgewarsMobile/Classes/SingleTeamViewController.h
project_files/HedgewarsMobile/Classes/SingleTeamViewController.m
project_files/HedgewarsMobile/Classes/SupportViewController.h
project_files/HedgewarsMobile/Classes/TableViewControllerWithDoneButton.h
project_files/HedgewarsMobile/Classes/TableViewControllerWithDoneButton.m
project_files/HedgewarsMobile/Classes/TeamSettingsViewController.h
project_files/HedgewarsMobile/Classes/TeamSettingsViewController.m
project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.h
project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.m
project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj
--- a/project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.h	Sat Oct 17 20:07:10 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.h	Mon Oct 19 03:39:47 2015 +0200
@@ -18,9 +18,9 @@
 
 
 #import <UIKit/UIKit.h>
-
+#import "TableViewControllerWithDoneButton.h"
 
-@interface GeneralSettingsViewController : UITableViewController <EditableCellViewDelegate> {
+@interface GeneralSettingsViewController : TableViewControllerWithDoneButton <EditableCellViewDelegate> {
 
 }
 
--- a/project_files/HedgewarsMobile/Classes/LevelViewController.m	Sat Oct 17 20:07:10 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/LevelViewController.m	Mon Oct 19 03:39:47 2015 +0200
@@ -58,10 +58,6 @@
     [self.tableView setContentOffset:CGPointMake(0,0) animated:NO];
 }
 
--(void) viewWillDisappear:(BOOL)animated {
- // stuff like checking that at least 1 field was selected
-}
-
 #pragma mark -
 #pragma mark Table view data source
 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
--- a/project_files/HedgewarsMobile/Classes/MGSplitViewController/MGSplitCornersView.m	Sat Oct 17 20:07:10 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/MGSplitViewController/MGSplitCornersView.m	Mon Oct 19 03:39:47 2015 +0200
@@ -34,8 +34,6 @@
 - (void)dealloc
 {
 	self.cornerBackgroundColor = nil;
-    
-    [super dealloc];
 }
 
 
--- a/project_files/HedgewarsMobile/Classes/MGSplitViewController/MGSplitDividerView.m	Sat Oct 17 20:07:10 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/MGSplitViewController/MGSplitDividerView.m	Mon Oct 19 03:39:47 2015 +0200
@@ -31,8 +31,6 @@
 - (void)dealloc
 {
 	self.splitViewController = nil;
-    
-    [super dealloc];
 }
 
 
--- a/project_files/HedgewarsMobile/Classes/MGSplitViewController/MGSplitViewController.m	Sat Oct 17 20:07:10 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/MGSplitViewController/MGSplitViewController.m	Mon Oct 19 03:39:47 2015 +0200
@@ -152,8 +152,6 @@
 	_delegate = nil;
 	_viewControllers = nil;
 	[self.view.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
-    
-    [super dealloc];
 }
 
 
--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Sat Oct 17 20:07:10 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Mon Oct 19 03:39:47 2015 +0200
@@ -20,7 +20,8 @@
 #import "MainMenuViewController.h"
 #import <QuartzCore/QuartzCore.h>
 #import "GameConfigViewController.h"
-#import "SettingsContainerViewController.h"
+#import "MGSplitViewController.h"
+#import "SettingsBaseViewController.h"
 #import "AboutViewController.h"
 #import "SavedGamesViewController.h"
 #import "RestoreViewController.h"
@@ -29,6 +30,13 @@
 #import "ServerProtocolNetwork.h"
 #import "GameInterfaceBridge.h"
 
+#import "SettingsBaseViewController.h"
+#import "GeneralSettingsViewController.h"
+#import "TeamSettingsViewController.h"
+#import "WeaponSettingsViewController.h"
+#import "SchemeSettingsViewController.h"
+#import "SupportViewController.h"
+
 #ifdef DEBUG
 #import "GameLogViewController.h"
 #endif
@@ -120,12 +128,75 @@
             [gcvc release];
             break;
         case 2:
+            if (IS_IPAD())
             {
-                SettingsContainerViewController *svrc = [[SettingsContainerViewController alloc] initWithNibName:nil bundle:nil];
-                svrc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
+                // the contents on the right of the splitview, setting targetController to nil to avoid creating the table
+                SettingsBaseViewController *rightController = [[SettingsBaseViewController alloc] init];
+                rightController.targetController = nil;
+                UINavigationController *rightNavController = [[UINavigationController alloc] initWithRootViewController:rightController];
+                [rightController release];
+                
+                // the contens on the left of the splitview, setting targetController that will receive push/pop actions
+                SettingsBaseViewController *leftController = [[SettingsBaseViewController alloc] init];
+                leftController.targetController = rightNavController.topViewController;
+                UINavigationController *leftNavController = [[UINavigationController alloc] initWithRootViewController:leftController];
+                [leftController release];
+                
+                MGSplitViewController *splitViewRootController = [[MGSplitViewController alloc] init];
+                splitViewRootController.delegate = nil;
+                splitViewRootController.showsMasterInPortrait = YES;
+                splitViewRootController.viewControllers = [NSArray arrayWithObjects:leftNavController, rightNavController, nil];
+                [leftNavController release];
+                [rightNavController release];
 
-                [self presentViewController:svrc animated:YES completion:nil];
-                [svrc release];
+                [self presentViewController:splitViewRootController animated:YES completion:nil];
+                [splitViewRootController release];
+            }
+            else
+            {
+                NSMutableArray *tabBarNavigationControllers = [[NSMutableArray alloc] initWithCapacity:5];
+                
+                UIViewController *generalSettingsViewController = [[GeneralSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
+                generalSettingsViewController.tabBarItem = [self tabBarItemWithTitle:NSLocalizedString(@"General",@"") imageName:@"flower" selectedImageName:@"flower_filled"];
+                UINavigationController *generalNavController = [[UINavigationController alloc] initWithRootViewController:generalSettingsViewController];
+                [generalSettingsViewController release];
+                [tabBarNavigationControllers addObject:generalNavController];
+                [generalNavController release];
+                
+                UIViewController *teamSettingsViewController = [[TeamSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
+                teamSettingsViewController.tabBarItem = [self tabBarItemWithTitle:NSLocalizedString(@"Teams",@"") imageName:@"teams" selectedImageName:@"teams_filled"];
+                UINavigationController *teamNavController = [[UINavigationController alloc] initWithRootViewController:teamSettingsViewController];
+                [teamSettingsViewController release];
+                [tabBarNavigationControllers addObject:teamNavController];
+                [teamNavController release];
+                
+                UIViewController *weaponSettingsViewController = [[WeaponSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
+                weaponSettingsViewController.tabBarItem = [self tabBarItemWithTitle:NSLocalizedString(@"Weapons",@"") imageName:@"bullet" selectedImageName:@"bullet_filled"];
+                UINavigationController *weaponNavController = [[UINavigationController alloc] initWithRootViewController:weaponSettingsViewController];
+                [weaponSettingsViewController release];
+                [tabBarNavigationControllers addObject:weaponNavController];
+                [weaponNavController release];
+                
+                UIViewController *schemeSettingsViewController = [[SchemeSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
+                schemeSettingsViewController.tabBarItem = [self tabBarItemWithTitle:NSLocalizedString(@"Schemes",@"") imageName:@"target" selectedImageName:@"target_filled"];
+                UINavigationController *schemeNavController = [[UINavigationController alloc] initWithRootViewController:schemeSettingsViewController];
+                [schemeSettingsViewController release];
+                [tabBarNavigationControllers addObject:schemeNavController];
+                [schemeNavController release];
+                
+                UIViewController *supportViewController = [[SupportViewController alloc] initWithStyle:UITableViewStyleGrouped];
+                supportViewController.tabBarItem = [self tabBarItemWithTitle:NSLocalizedString(@"Support",@"") imageName:@"heart" selectedImageName:@"heart_filled"];
+                UINavigationController *supportNavController = [[UINavigationController alloc] initWithRootViewController:supportViewController];
+                [supportViewController release];
+                [tabBarNavigationControllers addObject:supportNavController];
+                [supportNavController release];
+                
+                UITabBarController *settingsTabController = [[UITabBarController alloc] init];
+                settingsTabController.viewControllers = tabBarNavigationControllers;
+                [tabBarNavigationControllers release];
+                
+                [self presentViewController:settingsTabController animated:YES completion:nil];
+                [settingsTabController release];
             }
             break;
         case 3:
@@ -189,6 +260,15 @@
     }
 }
 
+- (UITabBarItem *)tabBarItemWithTitle: (NSString *)title
+                            imageName: (NSString *)imageName
+                    selectedImageName: (NSString *)selectedImageName
+{
+    return [[[UITabBarItem alloc] initWithTitle:title
+                                          image:[UIImage imageNamed:imageName]
+                                  selectedImage:[UIImage imageNamed:selectedImageName]] autorelease];
+}
+
 #pragma mark -
 -(void) viewDidUnload {
     MSG_DIDUNLOAD();
--- a/project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.h	Sat Oct 17 20:07:10 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.h	Mon Oct 19 03:39:47 2015 +0200
@@ -18,13 +18,10 @@
 
 
 #import <UIKit/UIKit.h>
-
-
-@class SingleSchemeViewController;
+#import "TableViewControllerWithDoneButton.h"
 
-@interface SchemeSettingsViewController : UITableViewController {
+@interface SchemeSettingsViewController : TableViewControllerWithDoneButton {
     NSMutableArray *listOfSchemes;
-    SingleSchemeViewController *childController;
 }
 
 @property (nonatomic, retain) NSMutableArray *listOfSchemes;
--- a/project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.m	Sat Oct 17 20:07:10 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.m	Mon Oct 19 03:39:47 2015 +0200
@@ -131,43 +131,43 @@
 
 #pragma mark -
 #pragma mark Table view delegate
--(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
-    if (childController == nil) {
-        childController = [[SingleSchemeViewController alloc] initWithStyle:UITableViewStyleGrouped];
-    }
-
+-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    SingleSchemeViewController *singleSchemeViewController = [[SingleSchemeViewController alloc] initWithStyle:UITableViewStyleGrouped];
+    
     NSInteger row = [indexPath row];
     NSString *selectedSchemeFile = [self.listOfSchemes objectAtIndex:row];
 
     // this must be set so childController can load the correct plist
-    childController.schemeName = [selectedSchemeFile stringByDeletingPathExtension];
-    [childController.tableView setContentOffset:CGPointMake(0,0) animated:NO];
+    singleSchemeViewController.schemeName = [selectedSchemeFile stringByDeletingPathExtension];
+    [singleSchemeViewController.tableView setContentOffset:CGPointMake(0,0) animated:NO];
 
-    [self.navigationController pushViewController:childController animated:YES];
+    [self.navigationController pushViewController:singleSchemeViewController animated:YES];
+    [singleSchemeViewController 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;
     MSG_MEMCLEAN();
 }
 
--(void) viewDidUnload {
+-(void) viewDidUnload
+{
     self.listOfSchemes = nil;
-    childController = nil;
     MSG_DIDUNLOAD();
     [super viewDidUnload];
 }
 
 
--(void) dealloc {
+-(void) dealloc
+{
     releaseAndNil(listOfSchemes);
-    releaseAndNil(childController);
     [super dealloc];
 }
 
--- a/project_files/HedgewarsMobile/Classes/SettingsBaseViewController.h	Sat Oct 17 20:07:10 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/SettingsBaseViewController.h	Mon Oct 19 03:39:47 2015 +0200
@@ -19,29 +19,16 @@
 
 #import <UIKit/UIKit.h>
 
-
-@class GeneralSettingsViewController;
-@class TeamSettingsViewController;
-@class WeaponSettingsViewController;
-@class SchemeSettingsViewController;
-@class SupportViewController;
-
 @interface SettingsBaseViewController : UIViewController <UITableViewDelegate, UITableViewDataSource, UITabBarControllerDelegate> {
     UIViewController *targetController;
     NSArray *controllerNames;
     NSIndexPath *lastIndexPath;
     UITabBarController *tabController;
-    GeneralSettingsViewController *generalSettingsViewController;
-    TeamSettingsViewController *teamSettingsViewController;
-    WeaponSettingsViewController *weaponSettingsViewController;
-    SchemeSettingsViewController *schemeSettingsViewController;
-    SupportViewController *supportViewController;
 }
 
 @property (nonatomic, retain) UIViewController *targetController;
 @property (nonatomic, retain) NSArray *controllerNames;
 @property (nonatomic, retain) NSIndexPath *lastIndexPath;
-@property (nonatomic, retain) UITabBarController *tabController;
 
 -(void) dismissSplitView;
 
--- a/project_files/HedgewarsMobile/Classes/SettingsBaseViewController.m	Sat Oct 17 20:07:10 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/SettingsBaseViewController.m	Mon Oct 19 03:39:47 2015 +0200
@@ -26,7 +26,7 @@
 
 
 @implementation SettingsBaseViewController
-@synthesize tabController, targetController, controllerNames, lastIndexPath;
+@synthesize targetController, controllerNames, lastIndexPath;
 
 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
     return rotationManager(interfaceOrientation);
@@ -45,10 +45,13 @@
     self.controllerNames = array;
     [array release];
 
-    if (IS_IPAD()) {
+    if (IS_IPAD())
+    {
         // this class gets loaded twice, we tell the difference by looking at targetController
-        if (self.targetController != nil) {
+        if (self.targetController != nil)
+        {
             UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStylePlain];
+            tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
             tableView.delegate = self;
             tableView.dataSource = self;
             [tableView reloadData];
@@ -57,68 +60,10 @@
             [tableView release];
             self.navigationItem.leftBarButtonItem = [self doneButton];
         }
-    } else {
-        // this class just loads all controllers and set up tabbar and navigation controllers
-        NSMutableArray *tabBarNavigationControllers = [[NSMutableArray alloc] initWithCapacity:5];
-        UINavigationController *navController = nil;
-
-        if (nil == generalSettingsViewController) {
-            generalSettingsViewController = [[GeneralSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
-            generalSettingsViewController.tabBarItem = [self tabBarItemWithTitle:[self.controllerNames objectAtIndex:0] imageName:@"flower" selectedImageName:@"flower_filled"];
-            navController = [[UINavigationController alloc] initWithRootViewController:generalSettingsViewController];
-            UIBarButtonItem *generalSettingsDoneButton = [self doneButton];
-            generalSettingsViewController.navigationItem.backBarButtonItem = generalSettingsDoneButton;
-            generalSettingsViewController.navigationItem.leftBarButtonItem = generalSettingsDoneButton;
-            [generalSettingsViewController release];
-            [tabBarNavigationControllers addObject:navController];
-            releaseAndNil(navController);
-        }
-        if (nil == teamSettingsViewController) {
-            teamSettingsViewController = [[TeamSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
-            teamSettingsViewController.tabBarItem = [self tabBarItemWithTitle:[self.controllerNames objectAtIndex:1] imageName:@"teams" selectedImageName:@"teams_filled"];
-            navController = [[UINavigationController alloc] initWithRootViewController:teamSettingsViewController];
-            UIBarButtonItem *teamSettingsDoneButton = [self doneButton];
-            teamSettingsViewController.navigationItem.backBarButtonItem = teamSettingsDoneButton;
-            teamSettingsViewController.navigationItem.leftBarButtonItem = teamSettingsDoneButton;
-            [tabBarNavigationControllers addObject:navController];
-            releaseAndNil(navController);
-        }
-        if (nil == weaponSettingsViewController) {
-            weaponSettingsViewController = [[WeaponSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
-            weaponSettingsViewController.tabBarItem = [self tabBarItemWithTitle:[self.controllerNames objectAtIndex:2] imageName:@"bullet" selectedImageName:@"bullet_filled"];
-            navController = [[UINavigationController alloc] initWithRootViewController:weaponSettingsViewController];
-            UIBarButtonItem *weaponSettingsDoneButton = [self doneButton];
-            weaponSettingsViewController.navigationItem.backBarButtonItem = weaponSettingsDoneButton;
-            weaponSettingsViewController.navigationItem.leftBarButtonItem = weaponSettingsDoneButton;
-            [tabBarNavigationControllers addObject:navController];
-            releaseAndNil(navController);
-        }
-        if (nil == schemeSettingsViewController) {
-            schemeSettingsViewController = [[SchemeSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
-            schemeSettingsViewController.tabBarItem = [self tabBarItemWithTitle:[self.controllerNames objectAtIndex:3] imageName:@"target" selectedImageName:@"target_filled"];
-            navController = [[UINavigationController alloc] initWithRootViewController:schemeSettingsViewController];
-            UIBarButtonItem *schemeSettingsDoneButton = [self doneButton];
-            schemeSettingsViewController.navigationItem.backBarButtonItem = schemeSettingsDoneButton;
-            schemeSettingsViewController.navigationItem.leftBarButtonItem = schemeSettingsDoneButton;
-            [tabBarNavigationControllers addObject:navController];
-            releaseAndNil(navController);
-        }
-        if (nil == supportViewController) {
-            supportViewController = [[SupportViewController alloc] initWithStyle:UITableViewStyleGrouped];
-            supportViewController.tabBarItem = [self tabBarItemWithTitle:[self.controllerNames objectAtIndex:4] imageName:@"heart" selectedImageName:@"heart_filled"];
-            navController = [[UINavigationController alloc] initWithRootViewController:supportViewController];
-            UIBarButtonItem *supportViewDoneButton = [self doneButton];
-            supportViewController.navigationItem.backBarButtonItem = supportViewDoneButton;
-            supportViewController.navigationItem.leftBarButtonItem = supportViewDoneButton;
-            [tabBarNavigationControllers addObject:navController];
-            releaseAndNil(navController);
-        }
-
-        self.tabController = [[UITabBarController alloc] init];
-        self.tabController.viewControllers = tabBarNavigationControllers;
-        self.tabController.delegate = self;
-
-        [self.view addSubview:self.tabController.view];
+    }
+    else
+    {
+        //iPhone part moved to MainMenuViewController
     }
 
     [super viewDidLoad];
@@ -131,34 +76,11 @@
                                                          action:@selector(dismissSplitView)] autorelease];
 }
 
-- (UITabBarItem *)tabBarItemWithTitle: (NSString *)title
-                            imageName: (NSString *)imageName
-                    selectedImageName: (NSString *)selectedImageName
-{
-    return [[[UITabBarItem alloc] initWithTitle:title
-                                          image:[UIImage imageNamed:imageName]
-                                  selectedImage:[UIImage imageNamed:selectedImageName]] autorelease];
-}
-
--(void) tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
-    [viewController viewWillAppear:NO];
-}
-
 -(void) dismissSplitView {
     [[AudioManagerController mainManager] playBackSound];
     [[[HedgewarsAppDelegate sharedAppDelegate] mainViewController] dismissViewControllerAnimated:YES completion:nil];
 }
 
--(void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
-    if (IS_IPAD() == NO)
-        return;
-
-    if (self.targetController != nil) {
-        CGRect screenRect = [[UIScreen mainScreen] safeBounds];
-        self.view.frame = CGRectMake(0, 0, 320, screenRect.size.height);
-    }
-}
-
 #pragma mark -
 #pragma mark Table view data source
 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
@@ -210,40 +132,33 @@
 
 #pragma mark -
 #pragma mark Table view delegate
--(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
     NSInteger newRow = [indexPath row];
     NSInteger oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
     UIViewController *nextController = nil;
 
-    if (newRow != oldRow) {
+    if (newRow != oldRow)
+    {
         [tableView deselectRowAtIndexPath:lastIndexPath animated:YES];
         [targetController.navigationController popToRootViewControllerAnimated:NO];
 
-        switch (newRow) {
+        switch (newRow)
+        {
             case 0:
-                if (nil == generalSettingsViewController)
-                    generalSettingsViewController = [[GeneralSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
-                nextController = generalSettingsViewController;
+                nextController = [[GeneralSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];;
                 break;
             case 1:
-                if (nil == teamSettingsViewController)
-                    teamSettingsViewController = [[TeamSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
-                nextController = teamSettingsViewController;
+                nextController = [[TeamSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
                 break;
             case 2:
-                if (nil == weaponSettingsViewController)
-                    weaponSettingsViewController = [[WeaponSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
-                nextController = weaponSettingsViewController;
+                nextController = [[WeaponSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
                 break;
             case 3:
-                if (nil == schemeSettingsViewController)
-                    schemeSettingsViewController = [[SchemeSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
-                nextController = schemeSettingsViewController;
+                nextController = [[SchemeSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
                 break;
             case 4:
-                if (nil == supportViewController)
-                    supportViewController = [[SupportViewController alloc] initWithStyle:UITableViewStyleGrouped];
-                nextController = supportViewController;
+                nextController = [[SupportViewController alloc] initWithStyle:UITableViewStyleGrouped];
                 break;
         }
 
@@ -253,6 +168,8 @@
         nextController.navigationItem.hidesBackButton = YES;
         [nextController viewWillAppear:NO];
         [targetController.navigationController pushViewController:nextController animated:NO];
+        [nextController release];
+        
         [[AudioManagerController mainManager] playClickSound];
     }
 }
@@ -260,62 +177,28 @@
 
 #pragma mark -
 #pragma mark Memory management
--(void) didReceiveMemoryWarning {
-    if (generalSettingsViewController.view.superview == nil)
-        generalSettingsViewController = nil;
-    if (teamSettingsViewController.view.superview == nil)
-        teamSettingsViewController = nil;
-    if (weaponSettingsViewController.view.superview == nil)
-        weaponSettingsViewController = nil;
-    if (schemeSettingsViewController.view.superview == nil)
-        schemeSettingsViewController = nil;
-    if (supportViewController.view.superview == nil)
-        supportViewController = nil;
-    if (tabController.view.superview == nil)
-        tabController = nil;
+-(void) didReceiveMemoryWarning
+{
     MSG_MEMCLEAN();
     [super didReceiveMemoryWarning];
 }
 
--(void) viewDidUnload {
+-(void) viewDidUnload
+{
     self.controllerNames = nil;
     self.lastIndexPath = nil;
     self.targetController = nil;
-    self.tabController = nil;
-    generalSettingsViewController = nil;
-    teamSettingsViewController = nil;
-    weaponSettingsViewController = nil;
-    schemeSettingsViewController = nil;
-    supportViewController = nil;
     MSG_DIDUNLOAD();
     [super viewDidUnload];
 }
 
--(void) dealloc {
+-(void) dealloc
+{
     releaseAndNil(targetController);
     releaseAndNil(controllerNames);
     releaseAndNil(lastIndexPath);
-    releaseAndNil(tabController);
-    releaseAndNil(generalSettingsViewController);
-    releaseAndNil(teamSettingsViewController);
-    releaseAndNil(weaponSettingsViewController);
-    releaseAndNil(schemeSettingsViewController);
-    releaseAndNil(supportViewController);
     [super dealloc];
 }
 
-
--(void) viewWillDisappear:(BOOL)animated {
-    // this will send -viewWillDisappear: only the active view
-    [self.tabController viewWillDisappear:animated];
-    // let's send that to every page, even though only GeneralSettingsViewController needs it
-    [generalSettingsViewController viewWillDisappear:animated];
-    [teamSettingsViewController viewWillDisappear:animated];
-    [weaponSettingsViewController viewWillDisappear:animated];
-    [schemeSettingsViewController viewWillDisappear:animated];
-    [supportViewController viewWillDisappear:animated];
-    [super viewWillDisappear:animated];
-}
-
 @end
 
--- a/project_files/HedgewarsMobile/Classes/SettingsContainerViewController.h	Sat Oct 17 20:07:10 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Hedgewars-iOS, a Hedgewars port for iOS devices
- * Copyright (c) 2009-2012 Vittorio Giovara <vittorio.giovara@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
- */
-
-
-#import <UIKit/UIKit.h>
-
-
-@class SettingsBaseViewController;
-@class MGSplitViewController;
-
-@interface SettingsContainerViewController : UIViewController {
-    SettingsBaseViewController *baseController;
-    MGSplitViewController *splitViewRootController;
-}
-
-@property (nonatomic,retain) SettingsBaseViewController *baseController;
-@property (nonatomic,retain) MGSplitViewController *splitViewRootController;
-
-@end
--- a/project_files/HedgewarsMobile/Classes/SettingsContainerViewController.m	Sat Oct 17 20:07:10 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/*
- * Hedgewars-iOS, a Hedgewars port for iOS devices
- * Copyright (c) 2009-2012 Vittorio Giovara <vittorio.giovara@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
- */
-
-
-#import "SettingsContainerViewController.h"
-#import "SettingsBaseViewController.h"
-#import "MGSplitViewController.h"
-
-
-@implementation SettingsContainerViewController
-@synthesize baseController, splitViewRootController;
-
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
-    return rotationManager(interfaceOrientation);
-}
-
--(void) viewDidLoad {
-    CGRect screenRect = [[UIScreen mainScreen] safeBounds];
-    self.view.frame = screenRect;
-
-    if (IS_IPAD()) {
-        // the contents on the right of the splitview, setting targetController to nil to avoid creating the table
-        SettingsBaseViewController *rightController = [[SettingsBaseViewController alloc] init];
-        rightController.targetController = nil;
-        UINavigationController *rightNavController = [[UINavigationController alloc] initWithRootViewController:rightController];
-        [rightController release];
-
-        // the contens on the left of the splitview, setting targetController that will receive push/pop actions
-        SettingsBaseViewController *leftController = [[SettingsBaseViewController alloc] init];
-        leftController.targetController = rightNavController.topViewController;
-        UINavigationController *leftNavController = [[UINavigationController alloc] initWithRootViewController:leftController];
-        [leftController release];
-
-        self.splitViewRootController = [[MGSplitViewController alloc] init];
-        self.splitViewRootController.delegate = nil;
-        self.splitViewRootController.view.frame = screenRect;
-        self.splitViewRootController.viewControllers = [NSArray arrayWithObjects: leftNavController, rightNavController, nil];
-        self.splitViewRootController.showsMasterInPortrait = YES;
-        [leftNavController release];
-        [rightNavController release];
-
-        // add view to main controller
-        [self.view addSubview:self.splitViewRootController.view];
-    } else {
-        if (nil == self.baseController) {
-            SettingsBaseViewController *sbvc = [[SettingsBaseViewController alloc] init];
-            self.baseController = sbvc;
-            [sbvc release];
-        }
-        self.baseController.targetController = nil;
-        self.baseController.view.frame = screenRect;
-
-        [self.view addSubview:self.baseController.view];
-    }
-
-    [super viewDidLoad];
-}
-
-#pragma mark -
-#pragma mark Memory management
--(void) didReceiveMemoryWarning {
-    if (self.baseController.view.superview == nil)
-        self.baseController = nil;
-    if (self.splitViewRootController.view.superview == nil)
-        self.splitViewRootController = nil;
-    MSG_MEMCLEAN();
-    [super didReceiveMemoryWarning];
-}
-
--(void) viewDidUnload {
-    self.baseController = nil;
-    self.splitViewRootController = nil;
-    MSG_DIDUNLOAD();
-    [super viewDidUnload];
-}
-
--(void) dealloc {
-    releaseAndNil(baseController);
-    releaseAndNil(splitViewRootController);
-    [super dealloc];
-}
-
-
-#pragma mark -
-#pragma mark view event management propagation
-// every time we add a uiviewcontroller programmatically we need to take care of propgating such messages
-// see http://davidebenini.it/2009/01/03/viewwillappear-not-being-called-inside-a-uinavigationcontroller/
--(void) viewWillAppear:(BOOL)animated {
-    [self.splitViewRootController.detailViewController viewWillAppear:animated];
-    [self.baseController viewWillAppear:animated];
-    [super viewWillAppear:animated];
-}
-
--(void) viewWillDisappear:(BOOL)animated {
-    [self.splitViewRootController.detailViewController viewWillDisappear:animated];
-    [self.baseController viewWillDisappear:animated];
-    [super viewWillDisappear:animated];
-}
-
--(void) viewDidAppear:(BOOL)animated {
-    [self.splitViewRootController.detailViewController viewDidAppear:animated];
-    [self.baseController viewDidAppear:animated];
-    [super viewDidAppear:animated];
-}
-
--(void) viewDidDisappear:(BOOL)animated {
-    [self.splitViewRootController.detailViewController viewDidDisappear:animated];
-    [self.baseController viewDidDisappear:animated];
-    [super viewDidDisappear:animated];
-}
-
--(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
-    [self.splitViewRootController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
-    [self.baseController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
-}
-
--(void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
-    [self.splitViewRootController willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration];
-    [self.baseController willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration];
-}
-
--(void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
-    [self.splitViewRootController didRotateFromInterfaceOrientation:fromInterfaceOrientation];
-    [self.baseController didRotateFromInterfaceOrientation:fromInterfaceOrientation];
-}
-
-@end
--- a/project_files/HedgewarsMobile/Classes/SingleTeamViewController.h	Sat Oct 17 20:07:10 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/SingleTeamViewController.h	Mon Oct 19 03:39:47 2015 +0200
@@ -19,14 +19,6 @@
 
 #import <UIKit/UIKit.h>
 
-
-@class HogHatViewController;
-@class GravesViewController;
-@class VoicesViewController;
-@class FortsViewController;
-@class FlagsViewController;
-@class LevelViewController;
-
 @interface SingleTeamViewController : UITableViewController <EditableCellViewDelegate> {
     NSMutableDictionary *teamDictionary;
 
@@ -36,13 +28,6 @@
     NSArray *secondaryItems;
     NSArray *moreSecondaryItems;
     BOOL isWriteNeeded;
-
-    HogHatViewController *hogHatViewController;
-    GravesViewController *gravesViewController;
-    VoicesViewController *voicesViewController;
-    FortsViewController *fortsViewController;
-    FlagsViewController *flagsViewController;
-    LevelViewController *levelViewController;
 }
 
 @property (nonatomic,retain) NSMutableDictionary *teamDictionary;
--- a/project_files/HedgewarsMobile/Classes/SingleTeamViewController.m	Sat Oct 17 20:07:10 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/SingleTeamViewController.m	Mon Oct 19 03:39:47 2015 +0200
@@ -306,43 +306,55 @@
     NSInteger row = [indexPath row];
     NSInteger section = [indexPath section];
 
-    if (2 == section) {
-        switch (row) {
+    if (2 == section)
+    {
+        switch (row)
+        {
             case 0: // grave
-                if (nil == gravesViewController)
-                    gravesViewController = [[GravesViewController alloc] initWithStyle:UITableViewStyleGrouped];
+            {
+                GravesViewController *gravesViewController = [[GravesViewController alloc] initWithStyle:UITableViewStyleGrouped];
 
                 [gravesViewController setTeamDictionary:teamDictionary];
                 [self.navigationController pushViewController:gravesViewController animated:YES];
+                [gravesViewController release];
                 break;
+            }
             case 1: // voice
-                if (nil == voicesViewController)
-                    voicesViewController = [[VoicesViewController alloc] initWithStyle:UITableViewStyleGrouped];
+            {
+                VoicesViewController *voicesViewController = [[VoicesViewController alloc] initWithStyle:UITableViewStyleGrouped];
 
                 [voicesViewController setTeamDictionary:teamDictionary];
                 [self.navigationController pushViewController:voicesViewController animated:YES];
+                [voicesViewController release];
                 break;
+            }
             case 2: // fort
-                if (nil == fortsViewController)
-                    fortsViewController = [[FortsViewController alloc] initWithStyle:UITableViewStyleGrouped];
+            {
+                FortsViewController *fortsViewController = [[FortsViewController alloc] initWithStyle:UITableViewStyleGrouped];
 
                 [fortsViewController setTeamDictionary:teamDictionary];
                 [self.navigationController pushViewController:fortsViewController animated:YES];
+                [fortsViewController release];
                 break;
+            }
             case 3: // flag
-                if (nil == flagsViewController)
-                    flagsViewController = [[FlagsViewController alloc] initWithStyle:UITableViewStyleGrouped];
+            {
+                FlagsViewController *flagsViewController = [[FlagsViewController alloc] initWithStyle:UITableViewStyleGrouped];
 
                 [flagsViewController setTeamDictionary:teamDictionary];
                 [self.navigationController pushViewController:flagsViewController animated:YES];
+                [flagsViewController release];
                 break;
+            }
             case 4: // level
-                if (nil == levelViewController)
-                    levelViewController = [[LevelViewController alloc] initWithStyle:UITableViewStyleGrouped];
+            {
+                LevelViewController *levelViewController = [[LevelViewController alloc] initWithStyle:UITableViewStyleGrouped];
 
                 [levelViewController setTeamDictionary:teamDictionary];
                 [self.navigationController pushViewController:levelViewController animated:YES];
+                [levelViewController release];
                 break;
+            }
             default:
                 DLog(@"Nope");
                 break;
@@ -371,32 +383,20 @@
 
 - (void)showHogHatViewControllerForHogIndex:(NSInteger)hogIndex
 {
-    if (nil == hogHatViewController)
-        hogHatViewController = [[HogHatViewController alloc] initWithStyle:UITableViewStyleGrouped];
+    HogHatViewController *hogHatViewController = [[HogHatViewController alloc] initWithStyle:UITableViewStyleGrouped];
     
     // cache the dictionary file of the team, so that other controllers can modify it
     hogHatViewController.teamDictionary = self.teamDictionary;
     hogHatViewController.selectedHog = hogIndex;
     
     [self.navigationController pushViewController:hogHatViewController animated:YES];
+    [hogHatViewController release];
 }
 
 #pragma mark -
 #pragma mark Memory management
 -(void) didReceiveMemoryWarning {
     [super didReceiveMemoryWarning];
-    if (hogHatViewController.view.superview == nil)
-        hogHatViewController = nil;
-    if (gravesViewController.view.superview == nil)
-        gravesViewController = nil;
-    if (voicesViewController.view.superview == nil)
-        voicesViewController = nil;
-    if (fortsViewController.view.superview == nil)
-        fortsViewController = nil;
-    if (flagsViewController.view.superview == nil)
-        flagsViewController = nil;
-    if (levelViewController.view.superview == nil)
-        levelViewController = nil;
     MSG_MEMCLEAN();
 }
 
@@ -407,12 +407,6 @@
     self.normalHogSprite = nil;
     self.secondaryItems = nil;
     self.moreSecondaryItems = nil;
-    hogHatViewController = nil;
-    gravesViewController = nil;
-    voicesViewController = nil;
-    flagsViewController = nil;
-    fortsViewController = nil;
-    levelViewController = nil;
     MSG_DIDUNLOAD();
     [super viewDidUnload];
 }
@@ -423,12 +417,6 @@
     releaseAndNil(normalHogSprite);
     releaseAndNil(secondaryItems);
     releaseAndNil(moreSecondaryItems);
-    releaseAndNil(hogHatViewController);
-    releaseAndNil(gravesViewController);
-    releaseAndNil(fortsViewController);
-    releaseAndNil(voicesViewController);
-    releaseAndNil(flagsViewController);
-    releaseAndNil(levelViewController);
     [super dealloc];
 }
 
--- a/project_files/HedgewarsMobile/Classes/SupportViewController.h	Sat Oct 17 20:07:10 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/SupportViewController.h	Mon Oct 19 03:39:47 2015 +0200
@@ -18,9 +18,9 @@
 
 
 #import <UIKit/UIKit.h>
-
+#import "TableViewControllerWithDoneButton.h"
 
-@interface SupportViewController : UITableViewController {
+@interface SupportViewController : TableViewControllerWithDoneButton {
     NSArray *waysToSupport;
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Classes/TableViewControllerWithDoneButton.h	Mon Oct 19 03:39:47 2015 +0200
@@ -0,0 +1,23 @@
+/*
+ * Hedgewars-iOS, a Hedgewars port for iOS devices
+ * Copyright (c) 2015 Anton Malmygin <antonc27@mail.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
+ */
+
+#import <UIKit/UIKit.h>
+
+@interface TableViewControllerWithDoneButton : UITableViewController
+
+@end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Classes/TableViewControllerWithDoneButton.m	Mon Oct 19 03:39:47 2015 +0200
@@ -0,0 +1,52 @@
+/*
+ * Hedgewars-iOS, a Hedgewars port for iOS devices
+ * Copyright (c) 2015 Anton Malmygin <antonc27@mail.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
+ */
+
+#import "TableViewControllerWithDoneButton.h"
+
+@interface TableViewControllerWithDoneButton ()
+
+@end
+
+@implementation TableViewControllerWithDoneButton
+
+- (void)viewDidLoad
+{
+    [super viewDidLoad];
+    
+    if (!IS_IPAD())
+    {
+        UIBarButtonItem *doneButton = [self doneButton];
+        self.navigationItem.backBarButtonItem = doneButton;
+        self.navigationItem.leftBarButtonItem = doneButton;
+    }
+}
+
+- (UIBarButtonItem *)doneButton
+{
+    return [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
+                                                          target:self
+                                                          action:@selector(dismissView)] autorelease];
+}
+
+- (void)dismissView
+{
+    [[AudioManagerController mainManager] playBackSound];
+    [[[HedgewarsAppDelegate sharedAppDelegate] mainViewController] dismissViewControllerAnimated:YES completion:nil];
+}
+
+@end
--- a/project_files/HedgewarsMobile/Classes/TeamSettingsViewController.h	Sat Oct 17 20:07:10 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/TeamSettingsViewController.h	Mon Oct 19 03:39:47 2015 +0200
@@ -18,13 +18,10 @@
 
 
 #import <UIKit/UIKit.h>
-
-
-@class SingleTeamViewController;
+#import "TableViewControllerWithDoneButton.h"
 
-@interface TeamSettingsViewController : UITableViewController {
+@interface TeamSettingsViewController : TableViewControllerWithDoneButton {
     NSMutableArray *listOfTeams;
-    SingleTeamViewController *childController;
 }
 
 @property (nonatomic, retain) NSMutableArray *listOfTeams;
--- a/project_files/HedgewarsMobile/Classes/TeamSettingsViewController.m	Sat Oct 17 20:07:10 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/TeamSettingsViewController.m	Mon Oct 19 03:39:47 2015 +0200
@@ -136,43 +136,43 @@
 
 #pragma mark -
 #pragma mark Table view delegate
--(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
-    if (childController == nil) {
-        childController = [[SingleTeamViewController alloc] initWithStyle:UITableViewStyleGrouped];
-    }
-
+-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    SingleTeamViewController *singleTeamViewController = [[SingleTeamViewController alloc] initWithStyle:UITableViewStyleGrouped];
+    
     NSInteger row = [indexPath row];
     NSString *selectedTeamFile = [listOfTeams objectAtIndex:row];
 
     // this must be set so childController can load the correct plist
-    childController.teamName = [selectedTeamFile stringByDeletingPathExtension];
-    [childController.tableView setContentOffset:CGPointMake(0,0) animated:NO];
+    singleTeamViewController.teamName = [selectedTeamFile stringByDeletingPathExtension];
+    [singleTeamViewController.tableView setContentOffset:CGPointMake(0,0) animated:NO];
 
-    [self.navigationController pushViewController:childController animated:YES];
+    [self.navigationController pushViewController:singleTeamViewController animated:YES];
+    [singleTeamViewController release];
+    
     [tableView deselectRowAtIndexPath:indexPath animated:YES];
 }
 
 
 #pragma mark -
 #pragma mark Memory management
--(void) didReceiveMemoryWarning {
+-(void) didReceiveMemoryWarning
+{
     // Releases the view if it doesn't have a superview.
     [super didReceiveMemoryWarning];
     // Relinquish ownership any cached data, images, etc that aren't in use.
-    if (childController.view.superview == nil )
-        childController = nil;
 }
 
--(void) viewDidUnload {
+-(void) viewDidUnload
+{
     self.listOfTeams = nil;
-    childController = nil;
     MSG_DIDUNLOAD();
     [super viewDidUnload];
 }
 
--(void) dealloc {
+-(void) dealloc
+{
     releaseAndNil(listOfTeams);
-    releaseAndNil(childController);
     [super dealloc];
 }
 
--- a/project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.h	Sat Oct 17 20:07:10 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.h	Mon Oct 19 03:39:47 2015 +0200
@@ -18,13 +18,10 @@
 
 
 #import <UIKit/UIKit.h>
-
-
-@class SingleWeaponViewController;
+#import "TableViewControllerWithDoneButton.h"
 
-@interface WeaponSettingsViewController : UITableViewController {
+@interface WeaponSettingsViewController : TableViewControllerWithDoneButton {
     NSMutableArray *listOfWeapons;
-    SingleWeaponViewController *childController;
 }
 
 @property (nonatomic, retain) NSMutableArray *listOfWeapons;
--- 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];
 }
 
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Sat Oct 17 20:07:10 2015 +0200
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Mon Oct 19 03:39:47 2015 +0200
@@ -74,9 +74,9 @@
 		615AD9EB1207654E00F2FF04 /* helpButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 615AD9EA1207654E00F2FF04 /* helpButton.png */; };
 		615BE3D4155C5DDF003CA34D /* uInputHandler.pas in Sources */ = {isa = PBXBuildFile; fileRef = 615BE3D3155C5DDF003CA34D /* uInputHandler.pas */; };
 		615E755A14E41E8C00FBA131 /* MXAudioPlayerFadeOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 615E755914E41E8C00FBA131 /* MXAudioPlayerFadeOperation.m */; };
-		615E76BC14E4421200FBA131 /* MGSplitCornersView.m in Sources */ = {isa = PBXBuildFile; fileRef = 615E76B714E4421200FBA131 /* MGSplitCornersView.m */; };
-		615E76BD14E4421200FBA131 /* MGSplitDividerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 615E76B914E4421200FBA131 /* MGSplitDividerView.m */; };
-		615E76BE14E4421200FBA131 /* MGSplitViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 615E76BB14E4421200FBA131 /* MGSplitViewController.m */; };
+		615E76BC14E4421200FBA131 /* MGSplitCornersView.m in Sources */ = {isa = PBXBuildFile; fileRef = 615E76B714E4421200FBA131 /* MGSplitCornersView.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
+		615E76BD14E4421200FBA131 /* MGSplitDividerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 615E76B914E4421200FBA131 /* MGSplitDividerView.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
+		615E76BE14E4421200FBA131 /* MGSplitViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 615E76BB14E4421200FBA131 /* MGSplitViewController.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
 		615FEAE212A2A6640098EE92 /* localplayButton~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 615FEADF12A2A6640098EE92 /* localplayButton~ipad.png */; };
 		615FEAE312A2A6640098EE92 /* localplayButton~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = 615FEAE012A2A6640098EE92 /* localplayButton~iphone.png */; };
 		616065A8159A71FD00CFAEF4 /* hwclassic.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 616065A7159A71FD00CFAEF4 /* hwclassic.mp3 */; };
@@ -96,7 +96,6 @@
 		6165921B11CA9BA200D6E256 /* SchemeWeaponConfigViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591FD11CA9BA200D6E256 /* SchemeWeaponConfigViewController.m */; };
 		6165921C11CA9BA200D6E256 /* SingleSchemeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591FF11CA9BA200D6E256 /* SingleSchemeViewController.m */; };
 		6165921D11CA9BA200D6E256 /* SingleTeamViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165920111CA9BA200D6E256 /* SingleTeamViewController.m */; };
-		6165921E11CA9BA200D6E256 /* SettingsContainerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165920311CA9BA200D6E256 /* SettingsContainerViewController.m */; };
 		6165921F11CA9BA200D6E256 /* TeamConfigViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165920511CA9BA200D6E256 /* TeamConfigViewController.m */; };
 		6165922011CA9BA200D6E256 /* TeamSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165920711CA9BA200D6E256 /* TeamSettingsViewController.m */; };
 		6165922111CA9BA200D6E256 /* VoicesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165920911CA9BA200D6E256 /* VoicesViewController.m */; };
@@ -264,6 +263,7 @@
 		F60D04881BD137B5003ACB00 /* teams_filled@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F60D04741BD137B5003ACB00 /* teams_filled@2x.png */; settings = {ASSET_TAGS = (); }; };
 		F60D04891BD137B5003ACB00 /* teams.png in Resources */ = {isa = PBXBuildFile; fileRef = F60D04751BD137B5003ACB00 /* teams.png */; settings = {ASSET_TAGS = (); }; };
 		F60D048A1BD137B5003ACB00 /* teams@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F60D04761BD137B5003ACB00 /* teams@2x.png */; settings = {ASSET_TAGS = (); }; };
+		F6448CE31BD2E00500C31C8C /* TableViewControllerWithDoneButton.m in Sources */ = {isa = PBXBuildFile; fileRef = F6448CE21BD2E00500C31C8C /* TableViewControllerWithDoneButton.m */; settings = {ASSET_TAGS = (); }; };
 		F65724FD1B7E784700A86262 /* helpabove.png in Resources */ = {isa = PBXBuildFile; fileRef = F65724F81B7E784700A86262 /* helpabove.png */; };
 		F65724FE1B7E784700A86262 /* helpbottom.png in Resources */ = {isa = PBXBuildFile; fileRef = F65724F91B7E784700A86262 /* helpbottom.png */; };
 		F65724FF1B7E784700A86262 /* helpleft.png in Resources */ = {isa = PBXBuildFile; fileRef = F65724FA1B7E784700A86262 /* helpleft.png */; };
@@ -529,8 +529,6 @@
 		616591FF11CA9BA200D6E256 /* SingleSchemeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SingleSchemeViewController.m; sourceTree = "<group>"; };
 		6165920011CA9BA200D6E256 /* SingleTeamViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SingleTeamViewController.h; sourceTree = "<group>"; };
 		6165920111CA9BA200D6E256 /* SingleTeamViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SingleTeamViewController.m; sourceTree = "<group>"; };
-		6165920211CA9BA200D6E256 /* SettingsContainerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsContainerViewController.h; sourceTree = "<group>"; };
-		6165920311CA9BA200D6E256 /* SettingsContainerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SettingsContainerViewController.m; sourceTree = "<group>"; };
 		6165920411CA9BA200D6E256 /* TeamConfigViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TeamConfigViewController.h; sourceTree = "<group>"; };
 		6165920511CA9BA200D6E256 /* TeamConfigViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TeamConfigViewController.m; sourceTree = "<group>"; };
 		6165920611CA9BA200D6E256 /* TeamSettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TeamSettingsViewController.h; sourceTree = "<group>"; };
@@ -751,6 +749,8 @@
 		F60D04741BD137B5003ACB00 /* teams_filled@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "teams_filled@2x.png"; path = "Resources/Icons/teams_filled@2x.png"; sourceTree = "<group>"; };
 		F60D04751BD137B5003ACB00 /* teams.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = teams.png; path = Resources/Icons/teams.png; sourceTree = "<group>"; };
 		F60D04761BD137B5003ACB00 /* teams@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "teams@2x.png"; path = "Resources/Icons/teams@2x.png"; sourceTree = "<group>"; };
+		F6448CE11BD2E00500C31C8C /* TableViewControllerWithDoneButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableViewControllerWithDoneButton.h; sourceTree = "<group>"; };
+		F6448CE21BD2E00500C31C8C /* TableViewControllerWithDoneButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableViewControllerWithDoneButton.m; sourceTree = "<group>"; };
 		F65724F81B7E784700A86262 /* helpabove.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = helpabove.png; sourceTree = "<group>"; };
 		F65724F91B7E784700A86262 /* helpbottom.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = helpbottom.png; sourceTree = "<group>"; };
 		F65724FA1B7E784700A86262 /* helpleft.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = helpleft.png; sourceTree = "<group>"; };
@@ -987,8 +987,6 @@
 		6163EE4C11CC2478001C0453 /* Settings Page */ = {
 			isa = PBXGroup;
 			children = (
-				6165920211CA9BA200D6E256 /* SettingsContainerViewController.h */,
-				6165920311CA9BA200D6E256 /* SettingsContainerViewController.m */,
 				616591F411CA9BA200D6E256 /* SettingsBaseViewController.h */,
 				616591F511CA9BA200D6E256 /* SettingsBaseViewController.m */,
 				6163EE4E11CC248D001C0453 /* First Level */,
@@ -1024,6 +1022,8 @@
 		6163EE4E11CC248D001C0453 /* First Level */ = {
 			isa = PBXGroup;
 			children = (
+				F6448CE11BD2E00500C31C8C /* TableViewControllerWithDoneButton.h */,
+				F6448CE21BD2E00500C31C8C /* TableViewControllerWithDoneButton.m */,
 				616591E811CA9BA200D6E256 /* GeneralSettingsViewController.h */,
 				616591E911CA9BA200D6E256 /* GeneralSettingsViewController.m */,
 				6165920611CA9BA200D6E256 /* TeamSettingsViewController.h */,
@@ -1830,7 +1830,6 @@
 				6165921B11CA9BA200D6E256 /* SchemeWeaponConfigViewController.m in Sources */,
 				6165921C11CA9BA200D6E256 /* SingleSchemeViewController.m in Sources */,
 				6165921D11CA9BA200D6E256 /* SingleTeamViewController.m in Sources */,
-				6165921E11CA9BA200D6E256 /* SettingsContainerViewController.m in Sources */,
 				6165921F11CA9BA200D6E256 /* TeamConfigViewController.m in Sources */,
 				6165922011CA9BA200D6E256 /* TeamSettingsViewController.m in Sources */,
 				6165922111CA9BA200D6E256 /* VoicesViewController.m in Sources */,
@@ -1853,6 +1852,7 @@
 				61006F95128DE31F00EBA7F7 /* CreationChamber.m in Sources */,
 				61A4A39412A5CCC2004D81E6 /* uCommandHandlers.pas in Sources */,
 				61A4A39512A5CCC2004D81E6 /* uCommands.pas in Sources */,
+				F6448CE31BD2E00500C31C8C /* TableViewControllerWithDoneButton.m in Sources */,
 				61A4A39612A5CCC2004D81E6 /* uDebug.pas in Sources */,
 				61A4A39712A5CCC2004D81E6 /* uGearsRender.pas in Sources */,
 				61A4A39812A5CCC2004D81E6 /* uRender.pas in Sources */,