允许UIImagePickerController编辑video但不编辑图像
在Whatsapp中上传图像或video,似乎使用了UIImagePicker
。
可以在该视图中编辑video,但无法编辑图像。 似乎在SDK中, allowsEditing
属性确定是否允许对图像和video进行编辑。
我如何获得像Whatsapp这样的行为,哪些video可以编辑但图像不能?
我通过侦听来自选择器的通知来实现此function。 在ViewDidLoad中注册
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(imageCaptured:) name:@"_UIImagePickerControllerUserDidCaptureItem" object:nil];
比确定何时允许编辑
- (void) imageCaptured:(NSNotification *)notification { if (self.pickerController.cameraCaptureMode == UIImagePickerControllerCameraCaptureModeVideo) { self.pickerController.allowsEditing = YES; } else{ self.pickerController.allowsEditing = NO; { }