我搜索了又搜索,但找不到基本的 UIImagepicker
视频保存代码。
我已设置好所有内容,只是一片空白。
- (void)imagePickerController:(UIImagePickerController *)
picker didFinishPickingMediaWithInfo:(NSDictionary *)
info{
}
我知道这与字典有关,但在那之后我迷路了,有什么帮助吗?
最佳答案
尝试使用此代码将视频保存到相册。
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[self dismissModalViewControllerAnimated:YES];
//get the videoURL
NSString *tempFilePath = [[info objectForKey:UIImagePickerControllerMediaURL] path];
if ( UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(tempFilePath))
{
// Copy it to the camera roll.
UISaveVideoAtPathToSavedPhotosAlbum(tempFilePath, self, @selector(video:didFinishSavingWithError:contextInfo:), tempFilePath);
}
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
[self dismissModalViewControllerAnimated:YES];
}
- (void) video: (NSString *) videoPath
didFinishSavingWithError: (NSError *) error
contextInfo: (void *) contextInfo {
NSLog(@"Finished saving video with error: %@", error);
}
关于video - 保存 UIImagePicker 视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6287413/