如何在iphone中从库中获取视频文件

时间:2011-07-11 06:08:06

标签: iphone objective-c

我正在尝试这样做。我知道这个问题非常简单。 拍摄视频:拍照:从图书馆中选择:我找到的所有内容都有单独的按钮。有点像在Facebook应用程序,当你点击相机按钮,你得到这张照片。

我想人们会尽快给我 提前致谢

2 个答案:

答案 0 :(得分:0)

要拍摄照片,视频并从照片库中选择一张图片,UIImagePickerController会为您提供帮助。

参考:UIImagePickerController

要拍摄照片和视频,必须正确设置UIImagePickerControllerCameraCaptureMode。

还需要根据需要设置sourceType。请参阅UIImagePickerControllerSourceType。

我猜这些摘要会对你有帮助。有关更多详细信息,请参阅参考资料。

如果你想浏览你的照片库,

    UIImagePickerController* picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = YES;
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    [self presentModalViewController:picker animated:YES];
    [picker release];

如果你想拍新照片,

    UIImagePickerController* picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = YES;
    picker. cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    [self presentModalViewController:picker animated:YES];
    [picker release];

如果你想拍摄新视频,

    UIImagePickerController* picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = YES;
    picker. cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo;
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    [self presentModalViewController:picker animated:YES];
    [picker release];

答案 1 :(得分:0)

我无法相信这不是一个小课程。所以我做了一个

https://github.com/fulldecent/FDTake

示例显示了拍照并从库中选择照片。