Bar*_*ryF 0 iphone uiimagepickercontroller uiimage ios5
我正在尝试保存用户使用相机拍摄的图像
1)如果我使用UIImageWriteToSavedPhotosAlbum我似乎无法分配我想要的fileName.怎么样,你能选择文件名吗?
使用此选项的好处是
[picker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
然后给出照片库目录的缩略图库.
2)它引导我到我的下一个问题可以
[picker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
用来从你自己的个人目录中获取图像?
3)无论如何以编程方式在照片库中创建子文件夹
4)最后,
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSPicturesDirectory, NSUserDomainMask, YES);
if (![[NSFileManager defaultManager] fileExistsAtPath:[paths objectAtIndex:0] isDirectory:&isDir]) {
NSError *error;
[[NSFileManager defaultManager] createDirectoryAtPath:[paths objectAtIndex:0 withIntermediateDirectories:YES attributes:nil error:&error];
}
Run Code Online (Sandbox Code Playgroud)
检查NSPicturesDirectory是否存在以便我可以写入它我不断收到Cocoa错误513
提前致谢
您无法为照片库图像指定文件名.ios将名为asset url的文件名分配给保存到照片库的图像,我们无法更改.
如果需要将图像保存到照片库,可以使用ALAssetsLibrary
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library writeImageToSavedPhotosAlbum:[image CGImage] orientation:(ALAssetOrientation) [image imageOrientation] completionBlock:^(NSURL *assetURL, NSError *error){
if (error)
{
// Eror
}
else
{
// Success
}
}];
[library release];
Run Code Online (Sandbox Code Playgroud)
有关更多信息,请检查: 如何将图片保存到iPhone照片库?
| 归档时间: |
|
| 查看次数: |
5382 次 |
| 最近记录: |