3

我正在尝试构建一个应用程序,让用户从 iPad 上的库中挑选和上传视频。我需要最大视频长度为 30 秒。

我正在使用以下代码:

UIImagePickerController *mediaPicker = [[UIImagePickerController alloc] init];

mediaPicker.mediaTypes = [NSArray arrayWithObjects:(NSString *)kUTTypeMovie,(NSString *)kUTTypeImage,nil];
mediaPicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;

mediaPicker.videoQuality = UIImagePickerControllerQualityTypeIFrame960x540;
mediaPicker.videoMaximumDuration = 30.0f;
mediaPicker.delegate = self;


if (self.imagePickerPopOverController.popoverVisible) {
    [self.imagePickerPopOverController dismissPopoverAnimated:YES];
}

self.imagePickerPopOverController = [[UIPopoverController alloc] initWithContentViewController:mediaPicker];
[self.imagePickerPopOverController presentPopoverFromBarButtonItem:self.navigationItem.rightBarButtonItem
                                          permittedArrowDirections:UIPopoverArrowDirectionUp
                                                          animated:NO];

选择视频后,我希望 UIImagePickerController 显示一个修剪器,将视频长度修剪为 30 秒(如果它更长),但事实并非如此。

4

1 回答 1

17

在您展示控制器之前进行设置。

imagePickerController.allowsEditing = YES;
于 2013-06-28T23:59:40.440 回答