cocoaTouch/MainMenuViewController.m
changeset 2799 558b29bf00c5
parent 2743 39d097ac2276
child 2803 1f446fc5c8ec
equal deleted inserted replaced
2798:d48bbe4518e6 2799:558b29bf00c5
     6 //  Copyright 2010 __MyCompanyName__. All rights reserved.
     6 //  Copyright 2010 __MyCompanyName__. All rights reserved.
     7 //
     7 //
     8 
     8 
     9 #import "MainMenuViewController.h"
     9 #import "MainMenuViewController.h"
    10 #import "SDL_uikitappdelegate.h"
    10 #import "SDL_uikitappdelegate.h"
       
    11 #import "PascalImports.h"
    11 
    12 
    12 @implementation MainMenuViewController
    13 @implementation MainMenuViewController
    13 
    14 
    14 @synthesize versionLabel, settingsViewController, mainView;
    15 @synthesize versionLabel, settingsViewController, mainView;
    15 
    16 
    33 	[super didReceiveMemoryWarning];
    34 	[super didReceiveMemoryWarning];
    34 	
    35 	
    35 	// Release any cached data, images, etc that aren't in use.
    36 	// Release any cached data, images, etc that aren't in use.
    36 	if (nil == self.settingsViewController.view.superview) {
    37 	if (nil == self.settingsViewController.view.superview) {
    37 		self.settingsViewController = nil;
    38 		self.settingsViewController = nil;
       
    39 		[settingsViewController release];
    38 	}
    40 	}
    39 }
    41 }
    40 
    42 
    41 
    43 
    42 // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
    44 // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
    43 -(void) viewDidLoad {
    45 -(void) viewDidLoad {
    44 	self.versionLabel.text = @"0.9.13-dev";
    46 	char *ver;
       
    47 	HW_versionInfo(NULL, &ver);
       
    48 	self.versionLabel.text = [[NSString stringWithUTF8String:ver] autorelease];
    45 	[super viewDidLoad];
    49 	[super viewDidLoad];
    46 }
    50 }
    47 
    51 
    48 - (void)viewDidUnload {
    52 - (void)viewDidUnload {
    49 	// Release any retained subviews of the main view.
    53 	// Release any retained subviews of the main view.
    90 		// view not created
    94 		// view not created
    91 		if (nil == self.settingsViewController) {
    95 		if (nil == self.settingsViewController) {
    92 			SettingsViewController *controller = [[SettingsViewController alloc] initWithNibName:@"SettingsViewController"
    96 			SettingsViewController *controller = [[SettingsViewController alloc] initWithNibName:@"SettingsViewController"
    93 												      bundle:nil];
    97 												      bundle:nil];
    94 			self.settingsViewController = controller;
    98 			self.settingsViewController = controller;
    95 			self.settingsViewController.parentView = self.mainView;
       
    96 			[controller release];
    99 			[controller release];
    97 		}
   100 		}
    98 		self.settingsViewController.view.frame = CGRectMake(0, -320, 480, 320);
   101 		self.settingsViewController.view.frame = CGRectMake(0, -320, 480, 320);
       
   102 		self.settingsViewController.parentView = self.mainView;
    99 
   103 
   100 		[UIView beginAnimations:@"View Switch" context:NULL];
   104 		[UIView beginAnimations:@"View Switch" context:NULL];
   101 		[UIView setAnimationDuration:3];
   105 		[UIView setAnimationDuration:1];
   102 		[UIView setAnimationDuration:UIViewAnimationCurveEaseOut];
   106 		//[UIView setAnimationDuration:UIViewAnimationCurveEaseOut];
   103 		self.settingsViewController.view.frame = CGRectMake(0, 0, 480, 320);
   107 		self.settingsViewController.view.frame = CGRectMake(0, 0, 480, 320);
   104 		self.mainView.frame = CGRectMake(0, 320, 480, 320);
   108 		self.mainView.frame = CGRectMake(0, 320, 480, 320);
   105 		
   109 		
   106 		[self.view addSubview:settingsViewController.view];
   110 		[self.view addSubview:settingsViewController.view];
   107 		[UIView commitAnimations];
   111 		[UIView commitAnimations];