Uploading an image or video in Whatsapp, seems to use a UIImagePicker
.
It's possible to edit video in that view, but images can't be edited. It seems that in the SDK, the allowsEditing
property determines whether editing is allowed for both images and video.
How can I get the behavior like Whatsapp, where video can be edited but images cannot?
I was able to achieve this functionality by listening for notifications from the picker. Sign-up in ViewDidLoad
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(imageCaptured:)
name:@"_UIImagePickerControllerUserDidCaptureItem" object:nil];
Than determine when to allowing editing
- (void) imageCaptured:(NSNotification *)notification
{
if (self.pickerController.cameraCaptureMode == UIImagePickerControllerCameraCaptureModeVideo) {
self.pickerController.allowsEditing = YES;
}
else{
self.pickerController.allowsEditing = NO;
{
}
To disallow image editing set allowsEditing = false
.
To allow video editing, present the picked video in a UIVideoEditorController
.
Or use a custom image / video picker that you can configure to your liking.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With