2015-11-23 24 views
-1

我想在Xamarin iOS应用程序中创建文件夹并将图像保存到该文件夹​​。 我使用下面的代码来创建该文件夹创建应用程序文件夹并在其中加载数据xamarin iOS

ALAssetsLibrary library = new ALAssetsLibrary(); 
       library.AddAssetsGroupAlbum("RentBlazr", g => 
       { 
        Console.WriteLine("Folder Created"); 
        //originalImage.SaveToPhotosAlbum((image, error) => { }); 
       }, 
       error => 
       { 
        Console.WriteLine("Error:" + error); 
       }); 

通过此文件夹中Folder..But我无法节省设备相机捕捉到这一新创建的文件夹的图片相册创建成功。

回答

1

我为此使用PCLStorage包。它是免费的,你可以从NugetGallery安装它。 https://github.com/dsplaisted/pclstorage

它有简单的API来处理文件系统。

public async Task PCLStorageSample() 
{ 
    IFolder rootFolder = FileSystem.Current.LocalStorage; 
    IFolder folder = await rootFolder.CreateFolderAsync("MySubFolder", 
     CreationCollisionOption.OpenIfExists); 
    IFile file = await folder.CreateFileAsync("answer.txt", 
     CreationCollisionOption.ReplaceExisting); 
    await file.WriteAllTextAsync("42"); 
} 
相关问题