Allow UIImagePickerController to edit video but not image

Uploading an image or video to Whatsapp seems to be using UIImagePicker .

Video editing is possible in this view, but images cannot be edited. In the SDK, it seems that the allowsEditing property determines whether editing is allowed for both images and video.

How can I get behavior like Whatsapp where the video can be edited but the images can not?

+7
source share
1 answer

I was able to achieve this functionality by listening to notifications from the collector. Register in ViewDidLoad

  [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(imageCaptured:) name:@"_UIImagePickerControllerUserDidCaptureItem" object:nil]; 

Then determine when to enable editing.

  - (void) imageCaptured:(NSNotification *)notification { if (self.pickerController.cameraCaptureMode == UIImagePickerControllerCameraCaptureModeVideo) { self.pickerController.allowsEditing = YES; } else{ self.pickerController.allowsEditing = NO; { } 
0
source

All Articles