title: How to display view on applicationDidBecomeActive with UITabBarController
body: <p>There is one issue that I've been struggling with and I can't seem to get enough information about it on the web. It has to do with the Apple multitasking and the Tab bar view. I want to control which tab will be selected when the application is entering foreground or becoming active.
  At the moment every time I will close the app and re-open it, it will open the last UIView that was displaying on the tab bar. How can I control that? </p>
  
  <p>Firstly, I want to be able to display a preview image with the app logo every time the application becomes active.  Here is the code I'm using for that but I keep getting EXC_BAD_ACCESS when the app is entering foreground for this line: [window addSubview:self.preMiniView]:</p>
  
  <pre><code>   - (void)applicationDidBecomeActive:(UIApplication *)application {
      if (!self.preMiniView)
      {
          self.preMiniView = [[UIImageView alloc] initWithFrame:window.frame];    
          self.preMiniView.frame = CGRectMake(0,0,324,480);
          window.backgroundColor = [UIColor colorWithRed:21.0/255.0 green:7.0/255.0 blue:2.0/255.0 alpha:1];  
      }       
      UIImage *img = [UIImage imageNamed:@"preloadSm.jpg"];
      self.preMiniView.image = img;
      [img release];
  
      if (self.preMiniView.alpha == 0.0)
      {
          [self.preMiniView setAlpha:1.0];
      }
  
      [window addSubview:self.preMiniView];  // adding the how to view to the view.
  
      [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(initApp:)
                                     userInfo:nil
                                      repeats:NO];
      }
  
  
  
        - (void)applicationDidEnterBackground:(UIApplication *)application 
         {
            [tabBarController.view endEditing:YES];
  
          [tabBarController.view setAlpha:0.0];
          [self.preMiniView release];
          self.preMiniView = nil;
          NSLog(@"applicationDidEnterBackground iphone"); 
      }
  
      - (void)initApp:(NSTimer *)timer
      {
          if (self.preMiniView)
          {
              [NSTimer scheduledTimerWithTimeInterval:0.5
                                               target:self     
                                             selector:@selector(removePrev:)
                                             userInfo:nil
                                              repeats:NO];
              [window insertSubview:tabBarController.view atIndex:0];
              [tabBarController.view setAlpha:1.0];
              [UIView beginAnimations:nil context:NULL];
              [UIView setAnimationDuration:.7];
              [self.preMiniView setAlpha:0.0];
              [UIView commitAnimations]; 
            }
      }
      - (void)removePrev:(NSTimer *)timer
      {
          [self.preMiniView removeFromSuperview];
      }
  </code></pre>
  
  <p>Secondly, I'm trying to present a pdf file with one of my UIViews when my app is hitting the method application:openURL:sourceApplication:annotation (used for opening a file from the email app). I get the correct file url but I'm not sure how to display the actual file in one of my custom UIView called PDFReaderViewController. It seems I can't just use this code on the AppDelegate:</p>
  
  <pre><code>pdfController = [[PDFReaderViewController alloc] init];
  [pdfController initFromName:fileName];
  
  [[self navigationController] pushViewController:pdfController animated:YES];
  [pdfController release];
  pdfController = nil;
  </code></pre>
  
  <p>I get a warning: receiver 'PDFReaderViewController' is a forward class and corresponding @interface may not exist</p>
  
  <p>Any idea how to display the new file using PDFReaderViewController from the AppDelegate?</p>
  
  <p>I must be missing something basic here .... thanks for your help!</p>