cocoaTouch/PopoverMenuViewController.m
changeset 3308 b6dcae4b6d2c
parent 3305 91074496d5c9
child 3335 2520ee7a5484
equal deleted inserted replaced
3307:275af46392bd 3308:b6dcae4b6d2c
    13 @implementation PopoverMenuViewController
    13 @implementation PopoverMenuViewController
    14 @synthesize menuList;
    14 @synthesize menuList;
    15 
    15 
    16 
    16 
    17 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    17 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    18     // Overriden to allow any orientation.
    18     return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
    19     return YES;
       
    20 }
    19 }
    21 
    20 
    22 -(void) didReceiveMemoryWarning {
    21 -(void) didReceiveMemoryWarning {
    23     // Releases the view if it doesn't have a superview.
    22     // Releases the view if it doesn't have a superview.
    24     [super didReceiveMemoryWarning];
    23     [super didReceiveMemoryWarning];
    25     
    24     self.menuList = nil;
    26     // Release any cached data, images, etc that aren't in use.
       
    27 }
    25 }
    28 
    26 
    29 -(void) viewDidLoad {
    27 -(void) viewDidLoad {
    30     isPaused = NO;
    28     isPaused = NO;
    31     self.tableView.allowsSelection = YES;
    29     self.tableView.allowsSelection = YES;
    79         case 1:
    77         case 1:
    80 			HW_chat();
    78 			HW_chat();
    81             //SDL_iPhoneKeyboardShow([SDLUIKitDelegate sharedAppDelegate].window);
    79             //SDL_iPhoneKeyboardShow([SDLUIKitDelegate sharedAppDelegate].window);
    82             break;
    80             break;
    83         case 2:
    81         case 2:
       
    82             // expand the view (and table) so that the actionsheet can be selected on the iPhone
       
    83             if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
       
    84                 [self.tableView deselectRowAtIndexPath:indexPath animated:NO];
       
    85                 [UIView beginAnimations:@"table width more" context:NULL];
       
    86                 [UIView setAnimationDuration:0.2];
       
    87                 self.view.frame = CGRectMake(0, 0, 480, 320);
       
    88                 [UIView commitAnimations];
       
    89             }
    84 			actionSheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"Are you reeeeeally sure?", @"")
    90 			actionSheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"Are you reeeeeally sure?", @"")
    85                                                       delegate:self
    91                                                       delegate:self
    86                                              cancelButtonTitle:NSLocalizedString(@"Well, maybe not...", @"")
    92                                              cancelButtonTitle:NSLocalizedString(@"Well, maybe not...", @"")
    87                                         destructiveButtonTitle:NSLocalizedString(@"Of course!", @"")
    93                                         destructiveButtonTitle:NSLocalizedString(@"Of course!", @"")
    88                                              otherButtonTitles:nil];
    94                                              otherButtonTitles:nil];
   101 }
   107 }
   102 
   108 
   103 #pragma mark -
   109 #pragma mark -
   104 #pragma mark actionSheet methods
   110 #pragma mark actionSheet methods
   105 -(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex {
   111 -(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex {
       
   112     if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){
       
   113         [UIView beginAnimations:@"table width less" context:NULL];
       
   114         [UIView setAnimationDuration:0.2];
       
   115         self.view.frame = CGRectMake(280, 0, 200, 170);
       
   116         [UIView commitAnimations];
       
   117     }
       
   118     
   106 	if ([actionSheet cancelButtonIndex] != buttonIndex) {
   119 	if ([actionSheet cancelButtonIndex] != buttonIndex) {
   107         [[NSNotificationCenter defaultCenter] postNotificationName:@"dismissPopover" object:nil];
   120         [[NSNotificationCenter defaultCenter] postNotificationName:@"dismissPopover" object:nil];
   108         HW_terminate(NO);
   121         HW_terminate(NO);
   109     }
   122     }
   110 	else
   123 	else