cocoaTouch/GameConfigViewController.m
changeset 3361 cfc6cd502f85
parent 3356 3ae3fccb439e
child 3364 e5403e2bf02c
equal deleted inserted replaced
3360:717b4e46e855 3361:cfc6cd502f85
     7 //
     7 //
     8 
     8 
     9 #import "GameConfigViewController.h"
     9 #import "GameConfigViewController.h"
    10 #import "SDL_uikitappdelegate.h"
    10 #import "SDL_uikitappdelegate.h"
    11 #import "CommodityFunctions.h"
    11 #import "CommodityFunctions.h"
       
    12 #import "TeamConfigViewController.h"
    12 
    13 
    13 @implementation GameConfigViewController
    14 @implementation GameConfigViewController
    14 @synthesize availableTeamsTableView, backButton, weaponsButton, schemesButton, mapButton, randomButton, startButton;
    15 @synthesize availableTeamsTableView, weaponsButton, schemesButton, mapButton, randomButton, startButton;
    15 
    16 
    16 
    17 
    17 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    18 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    18     return rotationManager(interfaceOrientation);
    19     return rotationManager(interfaceOrientation);
    19 }
    20 }
    20 
    21 
    21 
       
    22 -(IBAction) buttonPressed:(id) sender {
    22 -(IBAction) buttonPressed:(id) sender {
       
    23     // works even if it's not actually a button
    23     UIButton *theButton = (UIButton *)sender;
    24     UIButton *theButton = (UIButton *)sender;
    24     switch (theButton.tag) {
    25     switch (theButton.tag) {
    25         case 0:
    26         case 0:
    26             [[NSNotificationCenter defaultCenter] postNotificationName:@"dismissModalView" object:nil];
    27             [[NSNotificationCenter defaultCenter] postNotificationName:@"dismissModalView" object:nil];
    27             break;
    28             break;
    37 -(void) startSDLgame {
    38 -(void) startSDLgame {
    38     [[SDLUIKitDelegate sharedAppDelegate] startSDLgame];
    39     [[SDLUIKitDelegate sharedAppDelegate] startSDLgame];
    39 }
    40 }
    40 
    41 
    41 // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
    42 // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
    42 - (void)viewDidLoad {
    43 -(void) viewDidLoad {
    43     self.view.frame = CGRectMake(0, 0, 1024, 1024);
    44     teamConfigViewController = [[TeamConfigViewController alloc] initWithStyle:UITableViewStyleGrouped];
       
    45     activeController = teamConfigViewController;
       
    46     
       
    47     [self.view insertSubview:teamConfigViewController.view atIndex:0];
       
    48     
    44     [super viewDidLoad];
    49     [super viewDidLoad];
    45 }
    50 }
    46 
    51 
    47 -(void) didReceiveMemoryWarning {
    52 -(void) didReceiveMemoryWarning {
    48     // Releases the view if it doesn't have a superview.
    53     // Releases the view if it doesn't have a superview.
    50     // Release any cached data, images, etc that aren't in use.
    55     // Release any cached data, images, etc that aren't in use.
    51 }
    56 }
    52 
    57 
    53 
    58 
    54 -(void) viewDidUnload {
    59 -(void) viewDidUnload {
       
    60     activeController = nil;
       
    61     teamConfigViewController = nil;
    55     self.availableTeamsTableView = nil;
    62     self.availableTeamsTableView = nil;
    56     self.backButton = nil;
       
    57     self.weaponsButton = nil;
    63     self.weaponsButton = nil;
    58     self.schemesButton = nil;
    64     self.schemesButton = nil;
    59     self.mapButton = nil;
    65     self.mapButton = nil;
    60     self.randomButton = nil;
    66     self.randomButton = nil;
    61     self.startButton = nil;
    67     self.startButton = nil;
    62     [super viewDidUnload];
    68     [super viewDidUnload];
    63 }
    69 }
    64 
    70 
    65 
    71 
    66 -(void) dealloc {
    72 -(void) dealloc {
       
    73     [activeController release];
       
    74     [teamConfigViewController release];
    67     [availableTeamsTableView release];
    75     [availableTeamsTableView release];
    68     [backButton release];
       
    69     [weaponsButton release];
    76     [weaponsButton release];
    70     [schemesButton release];
    77     [schemesButton release];
    71     [mapButton release];
    78     [mapButton release];
    72     [randomButton release];
    79     [randomButton release];
    73     [startButton release];
    80     [startButton release];
    74     [super dealloc];
    81     [super dealloc];
    75 }
    82 }
    76 
    83 
       
    84 -(void) viewWillAppear:(BOOL)animated {
       
    85     [super viewWillAppear:animated];
       
    86     [activeController viewWillAppear:animated];
       
    87 }
       
    88 
       
    89 -(void) viewWillDisappear:(BOOL)animated {
       
    90     [super viewWillDisappear:animated];
       
    91     [activeController viewWillDisappear:animated];
       
    92 }
       
    93 
       
    94 -(void) viewDidAppear:(BOOL)animated {
       
    95     [super viewDidLoad];
       
    96     [activeController viewDidAppear:animated];
       
    97 }
       
    98 
       
    99 -(void) viewDidDisappear:(BOOL)animated {
       
   100     [super viewDidUnload];
       
   101     [activeController viewDidDisappear:animated];
       
   102 }
    77 
   103 
    78 @end
   104 @end