title: How to set allowsEditing for UIImagePickerController only for videos selected from photo library in iOS?
body: <p>I'm using UIImagePickerController in my applicaiton.
  I'm showing the following alert in button action.</p>
  
  <p><img src="https://i.stack.imgur.com/RX4C3.png" alt="enter image description here"></p>
  
  <p>My code looks like the following in alertview delegate method:</p>
  
  <pre><code>- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
      if ([alertView.title isEqualToString:@"Choose"]) {
          if (buttonIndex == 1) { //Camera
              [self presentImagePickerControllerWithCamera:YES];
          }
          else if(buttonIndex == 2) { //Library
              [self presentImagePickerControllerWithCamera:NO];
          }
      }
  }
  </code></pre>
  
  <p>and the content of the method 'presentImagePickerControllerWithCamera' is:</p>
  
  <pre><code>- (void)presentImagePickerControllerWithCamera:(BOOL)isCamera {
  
      CFStringRef mTypes[2] = { kUTTypeImage, kUTTypeMovie };
      CFArrayRef mTypesArray = CFArrayCreate(CFAllocatorGetDefault(), (const void**)mTypes, 2, &amp;kCFTypeArrayCallBacks);
      imagePickerController.mediaTypes = (__bridge NSArray*)mTypesArray;
      imagePickerController.videoMaximumDuration = 60.0f;
  
      CFRelease(mTypesArray);
      if (isCamera) { // Showing the camera (Both Camera and video)
          imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
          imagePickerController.videoQuality = UIImagePickerControllerQualityTypeMedium;
          imagePickerController.allowsEditing = NO;
      }
      else {  // Showing library (Both Pictures and videos)
          imagePickerController.allowsEditing = YES;
          imagePickerController.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
      }
  
      [self presentViewController:imagePickerController animated:YES completion:nil];
  }
  </code></pre>
  
  <p>Here i need to limit the video to 1 min when user is selecting video from library, so i wrote </p>
  
  <pre><code>imagePickerController.videoMaximumDuration = 60.0f;
  </code></pre>
  
  <p>and </p>
  
  <pre><code>    imagePickerController.allowsEditing = YES;
  </code></pre>
  
  <p>it's working fine. But When the user selects a picture from library i don't want editing(the square box on picture).
  Is there any way to achieve it?</p>
  
  <p>Any suggestions would be appreciated.
  Thanks in advance.</p>