title: Taps and gestures not recogized when iPad app launched in landscape
body: <p>When I launch my universal app on the iPad in landscape mode, the app won't recognize taps or gestures on the side of the screen closest to the home button.  I've gone over every similar question on stackoverflow trying to get to the bottom of this but I just can't get it to work.</p>
  
  <p>It would appear that one of the views in the view hierarchy is in portrait rather than landscape but I can't find any views that are incorrectly sized.  Also, note that the app works fine when launched in portrait mode and rotates correctly and recognizes all taps after rotation.  But when launched in landscape there is always a "dead zone" on one side of the screen where taps are not recognized.</p>
  
  <p>The view hierarchy looks like:</p>
  
  <pre><code>UIWindow (frame: 0, 0, 1024, 768)
  UINavigationController
    UIViewController
      UIView (frame: 0, 0, 1024, 768)
        GLView (frame: 0, 0, 1024, 768)
  </code></pre>
  
  <p>I have checked the frames and bounds for the views, sets <code>clipsToBounds = YES</code> and changed the background colors of them to see if they are not being layed out correctly but they are all occupying the entire screen (1024x768) as intended.</p>
  
  <p>I have subclassed <code>UIWindow</code> and overridden the <code>sendEvent:</code> method and it is NOT being called at all when I tap on the dead zone at the left hand side of the screen.  Does this indicate where the problem might lie?</p>
  
  <p>Here is my app delegate where the window is created:</p>
  
  <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
  
      // Create the main window
      CGRect windowFrame = [[UIScreen mainScreen] bounds];
      if (application.statusBarOrientation == UIInterfaceOrientationLandscapeLeft || application.statusBarOrientation == UIInterfaceOrientationLandscapeRight) {
          windowFrame = CGRectMake(0, 0, windowFrame.size.height, windowFrame.size.width);
      }
      window_ = [[MyUIWindow alloc] initWithFrame:windowFrame];
  
      navController_ = [[BFNavigationController alloc] init];
      navController_.navigationBarHidden = YES;
  
      // for rotation and other messages
      [[CCDirector sharedDirector] setDelegate:navController_];
  
      // set the Navigation Controller as the root view controller
      [window_ setRootViewController:navController_];
  
      bfViewController_ = [[BFViewController alloc] init];
      [navController_ pushViewController:bfViewController_ animated:NO];
  
      // make main window visible
      [window_ makeKeyAndVisible];
  
      return YES;
  }
  </code></pre>
  
  <p>And this is the UIViewController's viewDidLoad method where the UIView is configured:</p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
  
      UIWindow *mainWindow = (UIWindow*)[UIApplication sharedApplication].windows.firstObject;
      self.view.frame = mainWindow.bounds;
  
      self.view.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
      self.view.autoresizesSubviews = YES;
      self.view.clipsToBounds = YES;
  
      [self initCocos2D];
  
  }
  </code></pre>
  
  <p>And here's where the GLView is created:</p>
  
  <pre><code>- (void)initCocos2D {
  
      UIWindow *window = [[[UIApplication sharedApplication] windows] firstObject];
      CCDirector *director = (CCDirectorIOS*) [CCDirector sharedDirector];
  
      CCGLView *glView = [CCGLView viewWithFrame:[window bounds]
                                     pixelFormat:kEAGLColorFormatRGB565
                                     depthFormat:0
                              preserveBackbuffer:NO
                                      sharegroup:nil
                                   multiSampling:NO
                                 numberOfSamples:0];
  
      glView.clipsToBounds = YES;
      [glView setMultipleTouchEnabled:YES];
  
      director.wantsFullScreenLayout = YES;
  
      // set FPS at 60
      [director setAnimationInterval:1.0/60];
  
      // attach the openglView to the director
      [director setView:glView];
  
      // 2D projection
      [director setProjection:kCCDirectorProjection2D];
  
      // Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices
      if( ! [director enableRetinaDisplay:YES] )
          CCLOG(@"Retina Display Not supported");
  
      // Default texture format for PNG/BMP/TIFF/JPEG/GIF images
      // It can be RGBA8888, RGBA4444, RGB5_A1, RGB565
      // You can change this setting at any time.
      [CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];
  
      // Assume that PVR images have premultiplied alpha
      [CCTexture2D PVRImagesHavePremultipliedAlpha:YES];
  
      [self.view insertSubview:glView atIndex:0];
  
      [[CCDirector sharedDirector] startAnimation];
  }
  </code></pre>
  
  <p>The gesture recognizers are added to the glView and handled by the cocos2D game layer:</p>
  
  <pre><code>UIPanGestureRecognizer *panGestureRecognizer = [[[UIPanGestureRecognizer alloc] initWithTarget:layer action:@selector(handlePan:)] autorelease];
      [[CCDirector sharedDirector].view addGestureRecognizer:panGestureRecognizer];
  
      UITapGestureRecognizer *tapGestureRecognizer = [[[UITapGestureRecognizer alloc] initWithTarget:layer action:@selector(handleTap:)] autorelease];
      [[CCDirector sharedDirector].view addGestureRecognizer:tapGestureRecognizer];
  
      UIPinchGestureRecognizer *pinchGestureRecognizer = [[[UIPinchGestureRecognizer alloc] initWithTarget:layer action:@selector(handlePinch:)] autorelease];
      [[CCDirector sharedDirector].view addGestureRecognizer:pinchGestureRecognizer];
  </code></pre>
  
  <p>This is driving me crazy; any help would be much appreciated.</p>