title: Problems with UIImagePickerController cancel button not working
body: <p>I have an universal app that allows to select an image from the device photo library for later manipulation, the code works fine on the iPad but nothing happens on the iPhone, not even the cancel button and after an image is selected nothing happens neither here is my code:</p>
  
  <pre><code>-(IBAction)grabImage:(id)sender
  {
      if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad )
  {
      imgPicker = [[UIImagePickerController alloc] init];
      [imgPicker setDelegate:self];
  
      popover = [[UIPopoverController alloc] initWithContentViewController:imgPicker];
      [popover setDelegate:self];
  
      CGPoint position        = [view1.superview convertPoint:view1.frame.origin toView:nil];
      CGRect popOverFrame     = CGRectMake( position.x, position.y, self.view.frame.size.width, self.view.frame.size.height );
  
      [popover presentPopoverFromRect:popOverFrame inView:self.view permittedArrowDirections:nil animated:NO];
      [popover setPopoverContentSize:CGSizeMake(320, 480)];
      [imgPicker release];
  }
  else
  {
      imgPicker = [[UIImagePickerController alloc] init];
      imgPicker.delegate = self;
      imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
      [self presentModalViewController:self.imgPicker animated:YES];
      [imgPicker release];
  }
  }
  
  
  -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
  {
      pickedImage = [info objectForKey:UIImagePickerControllerOriginalImage];
  
  CGImageRef imgRef = pickedImage.CGImage;
  
      app-&gt;setImage( pickedImage, CGImageGetWidth(imgRef), CGImageGetHeight(imgRef) );
  
      [[picker parentViewController] dismissModalViewControllerAnimated:YES];
  
  // Enable texture siwth after an image has been loaded
  [textureSwitch setEnabled:YES];
  [textureSwitch setOn:YES];
  app-&gt;isTextureDrawingOn     = [textureSwitch isOn];
  
  [fillsSwitch setOn:NO];
  app-&gt;isFillsDrawingOn       = [fillsSwitch isOn];
  
      if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad )
  {
      [popover dismissPopoverAnimated:YES];
  }
  ofLog(OF_LOG_VERBOSE, "cancel after selection");
  }
  
  -(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
  {
  [[picker parentViewController] dismissModalViewControllerAnimated:YES];
  
  if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad )
  {
          [popover dismissPopoverAnimated:YES];
      }
  
  ofLog(OF_LOG_VERBOSE, "did cancel");
  }
  </code></pre>