title: How to use UIImagePickerController in iPad?
body: <p>Hi i am working on a universal application (iPhone/iPad). one feature is that i have to select a photo from album and show it on UIImageView.</p>
  
  <p>Now problem is that it is working good on iPhone but when i try to open photo album it crashes. my code in action sheet delegate is this:</p>
  
  <pre><code>- (void) actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
  {
      if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
          if ( ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]))
  
          {   
              if (buttonIndex == 0)
              {
                  [self lockAllImagesOnTheScreen];
                  imagePicker.sourceType=UIImagePickerControllerSourceTypeCamera;
                  [self presentModalViewController:imagePicker animated:YES];
              }
              if (buttonIndex == 1)
              {
                  [self lockAllImagesOnTheScreen];
  
                  imagePicker.sourceType= UIImagePickerControllerSourceTypePhotoLibrary;
                  [self presentModalViewController:imagePicker animated:YES];
              }
  
          }
          else {
  
              if (buttonIndex == 0)
              {
                  [self lockAllImagesOnTheScreen];
                  imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
                  imagePicker.sourceType= UIImagePickerControllerSourceTypePhotoLibrary;
                  [self presentModalViewController:imagePicker animated:YES];
              }
          }
  
  
  
      }
  
      else{
          if ( ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]))
  
          {   
              if (buttonIndex == 0)
              {
                  [self lockAllImagesOnTheScreen];
                  imagePicker.sourceType=UIImagePickerControllerSourceTypeCamera;
                  [self presentModalViewController:imagePicker animated:YES];
              }
              if (buttonIndex == 1)
              {
                  [self lockAllImagesOnTheScreen];
  
                  imagePicker.sourceType= UIImagePickerControllerSourceTypePhotoLibrary;
                  [self presentModalViewController:imagePicker animated:YES];
              }
  
          }
          else {
  
              if (buttonIndex == 0)
              {
                  [self lockAllImagesOnTheScreen];
                  imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
                  imagePicker.sourceType= UIImagePickerControllerSourceTypePhotoLibrary;
                  [self presentModalViewController:imagePicker animated:YES];
              }
          }
  
  
      }
  
  
  }
  </code></pre>
  
  <p>can any body help me out? i have checked on stackOverflow and also googled it but in vain.</p>