project_files/HedgewarsMobile/Classes/OverlayViewController.m
changeset 5155 f2165724605c
parent 5154 851f36579ed4
child 5156 641abe679bf0
equal deleted inserted replaced
5154:851f36579ed4 5155:f2165724605c
   186     [[NSNotificationCenter defaultCenter] addObserver:self
   186     [[NSNotificationCenter defaultCenter] addObserver:self
   187                                              selector:@selector(showHelp:)
   187                                              selector:@selector(showHelp:)
   188                                                  name:@"show help ingame"
   188                                                  name:@"show help ingame"
   189                                                object:nil];
   189                                                object:nil];
   190 
   190 
   191     // remove the view, required by the dual head version
       
   192     [[NSNotificationCenter defaultCenter] addObserver:self
       
   193                                              selector:@selector(removeOverlay:)
       
   194                                                  name:@"remove overlay"
       
   195                                                object:nil];
       
   196 
       
   197     // for iOS >= 3.2
   191     // for iOS >= 3.2
   198     if ([UIScreen respondsToSelector:@selector(screens)]) {
   192     if ([UIScreen respondsToSelector:@selector(screens)]) {
   199         [[NSNotificationCenter defaultCenter] addObserver:self
   193         [[NSNotificationCenter defaultCenter] addObserver:self
   200                                                  selector:@selector(numberOfScreensIncreased)
   194                                                  selector:@selector(numberOfScreensIncreased)
   201                                                      name:UIScreenDidConnectNotification
   195                                                      name:UIScreenDidConnectNotification
   241 }
   235 }
   242 
   236 
   243 
   237 
   244 -(void) showHelp:(id) sender {
   238 -(void) showHelp:(id) sender {
   245     if (self.helpPage == nil) {
   239     if (self.helpPage == nil) {
   246         NSString *xib;
   240         NSString *xibName = (IS_IPAD() ? @"HelpPageInGameViewController-iPad" : @"HelpPageInGameViewController-iPhone");
   247         if (IS_IPAD())
   241         self.helpPage = [[HelpPageViewController alloc] initWithNibName:xibName bundle:nil];
   248             xib = @"HelpPageInGameViewController-iPad";
       
   249         else
       
   250             xib = @"HelpPageInGameViewController-iPhone";
       
   251         self.helpPage = [[HelpPageViewController alloc] initWithNibName:xib bundle:nil];
       
   252     }
   242     }
   253     self.helpPage.view.alpha = 0;
   243     self.helpPage.view.alpha = 0;
   254     [self.view addSubview:helpPage.view];
   244     [self.view addSubview:helpPage.view];
   255     [UIView beginAnimations:@"helpingame" context:NULL];
   245     [UIView beginAnimations:@"helpingame" context:NULL];
   256     self.helpPage.view.alpha = 1;
   246     self.helpPage.view.alpha = 1;
   257     [UIView commitAnimations];
   247     [UIView commitAnimations];
   258     doNotDim();
   248     doNotDim();
   259 }
   249 }
   260 
   250 
   261 -(void) removeOverlay:(id) sender {
   251 -(void) removeOverlay {
   262     [self.popupMenu performSelectorOnMainThread:@selector(dismiss) withObject:nil waitUntilDone:YES];
   252     [self.popupMenu performSelectorOnMainThread:@selector(dismiss) withObject:nil waitUntilDone:YES];
   263     [self.popoverController performSelectorOnMainThread:@selector(dismissPopoverAnimated:) withObject:nil waitUntilDone:YES];
   253     [self.popoverController performSelectorOnMainThread:@selector(dismissPopoverAnimated:) withObject:nil waitUntilDone:YES];
   264     [self.view performSelectorOnMainThread:@selector(removeFromSuperview) withObject:nil waitUntilDone:YES];
   254     [self.view performSelectorOnMainThread:@selector(removeFromSuperview) withObject:nil waitUntilDone:YES];
   265     HW_terminate(NO);
   255     HW_terminate(NO);
   266 }
   256 }