cocoaTouch/MainMenuViewController.m
changeset 3029 67483e87590c
parent 3027 32890edaa483
child 3034 b576460ba8ad
equal deleted inserted replaced
3028:d17cf923d7c3 3029:67483e87590c
    74 		// file not present, means that also other files are absent
    74 		// file not present, means that also other files are absent
    75 		NSLog(@"First time run, creating settings files");
    75 		NSLog(@"First time run, creating settings files");
    76 		
    76 		
    77 		// show a popup with an indicator to make the user wait
    77 		// show a popup with an indicator to make the user wait
    78 		UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"One-time Preferences Configuration",@"")
    78 		UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"One-time Preferences Configuration",@"")
    79 								message:nil
    79                                                         message:nil
    80 							       delegate:nil
    80                                                        delegate:nil
    81 						      cancelButtonTitle:nil
    81                                               cancelButtonTitle:nil
    82 						      otherButtonTitles:nil];
    82                                               otherButtonTitles:nil];
    83 		[alert show];
    83 		[alert show];
    84 		
    84 		
    85 		UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] 
    85 		UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] 
    86 						      initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    86 						      initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    87 		indicator.center = CGPointMake(alert.bounds.size.width / 2, alert.bounds.size.height - 50);
    87 		indicator.center = CGPointMake(alert.bounds.size.width / 2, alert.bounds.size.height - 50);
   110 	[pool release];
   110 	[pool release];
   111 	[NSThread exit];
   111 	[NSThread exit];
   112 }
   112 }
   113 
   113 
   114 -(void) appear {
   114 -(void) appear {
       
   115     [[SDLUIKitDelegate sharedAppDelegate].uiwindow addSubview:self.view];
   115     [UIView beginAnimations:@"inserting main controller" context:NULL];
   116     [UIView beginAnimations:@"inserting main controller" context:NULL];
   116 	[UIView setAnimationDuration:1];
   117 	[UIView setAnimationDuration:1];
   117 	self.view.alpha = 1;
   118 	self.view.alpha = 1;
   118 	[UIView commitAnimations];
   119 	[UIView commitAnimations];
   119 }
   120 }
   121 -(void) disappear {
   122 -(void) disappear {
   122     [UIView beginAnimations:@"removing main controller" context:NULL];
   123     [UIView beginAnimations:@"removing main controller" context:NULL];
   123 	[UIView setAnimationDuration:1];
   124 	[UIView setAnimationDuration:1];
   124 	self.view.alpha = 0;
   125 	self.view.alpha = 0;
   125 	[UIView commitAnimations];
   126 	[UIView commitAnimations];
       
   127     [self.view removeFromSuperview];
   126 }
   128 }
   127 
   129 
   128 #pragma mark -
   130 #pragma mark -
   129 #pragma mark Action buttons
   131 #pragma mark Action buttons
   130 -(IBAction) startPlaying {
   132 -(IBAction) startPlaying {
   131 	[[SDLUIKitDelegate sharedAppDelegate] startSDLgame];
   133 	[[SDLUIKitDelegate sharedAppDelegate] startSDLgame];
   132 }
   134 }
   133 
   135 
   134 -(IBAction) notYetImplemented {
   136 -(IBAction) notYetImplemented {
   135 	UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Not Yet Implemented"
   137 	UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Not Yet Implemented"
   136 							message:@"Sorry, this feature is not yet implemented"
   138                                                     message:@"Sorry, this feature is not yet implemented"
   137 						       delegate:nil
   139                                                    delegate:nil
   138 					      cancelButtonTitle:@"Well, don't worry"
   140                                           cancelButtonTitle:@"Well, don't worry"
   139 					      otherButtonTitles:nil];
   141                                           otherButtonTitles:nil];
   140 	[alert show];
   142 	[alert show];
   141 	[alert release];
   143 	[alert release];
   142 }
   144 }
   143 
   145 
       
   146 /*
   144 -(IBAction) switchViews:(id)sender {
   147 -(IBAction) switchViews:(id)sender {
   145 
       
   146 	// view not displayed or not created
   148 	// view not displayed or not created
   147 	if (nil == self.settingsViewController.view.superview) {
   149 	if (nil == self.settingsViewController.view.superview) {
   148 		// view not created
   150 		// view not created
   149 		if (nil == self.settingsViewController) {
   151 		if (nil == self.settingsViewController) {
   150 			SettingsViewController *controller = [[SettingsViewController alloc] initWithNibName:@"SettingsViewController"
   152 			SettingsViewController *controller = [[SettingsViewController alloc] initWithNibName:@"SettingsViewController"
   162 		self.mainView.frame = CGRectMake(0, 299, 480, 278);
   164 		self.mainView.frame = CGRectMake(0, 299, 480, 278);
   163 		[UIView commitAnimations];
   165 		[UIView commitAnimations];
   164 		
   166 		
   165 		[self.view insertSubview:settingsViewController.view atIndex:0];
   167 		[self.view insertSubview:settingsViewController.view atIndex:0];
   166 	}
   168 	}
   167 
       
   168 }
   169 }
       
   170 */
   169 
   171 
   170 @end
   172 @end