Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/97.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 需要有关将下载图像显示为图库的帮助吗_Ios - Fatal编程技术网

Ios 需要有关将下载图像显示为图库的帮助吗

Ios 需要有关将下载图像显示为图库的帮助吗,ios,Ios,在我的应用程序中,我从url下载图像并保存到应用程序文档目录中。现在我想将这些下载的图像显示为图像库。对于我正在使用的图像库,我可以对其进行配置,并成功地将其推送到导航控制器上,并且fGallery视图也可见,但它不显示我的图像,我为fGallery提供如下图像阵列 头文件 @interface myController <FGalleryViewControllerDelegate> @property (strong, nonatomic) FGalleryViewContr

在我的应用程序中,我从url下载图像并保存到应用程序文档目录中。现在我想将这些下载的图像显示为图像库。对于我正在使用的图像库,我可以对其进行配置,并成功地将其推送到导航控制器上,并且fGallery视图也可见,但它不显示我的图像,我为fGallery提供如下图像阵列

头文件

@interface myController <FGalleryViewControllerDelegate> 

@property (strong, nonatomic) FGalleryViewController *localGallery;
@property (strong, nonatomic) NSMutableArray *localImages;
    //These are delegate methods of FGalleryViewControllerDelegate
    - (NSString*)photoGallery:(FGalleryViewController*)gallery filePathForPhotoSize:(FGalleryPhotoSize)size atIndex:(NSUInteger)index
    {
        return [localImages objectAtIndex:index];
    }

    - (NSString*)photoGallery:(FGalleryViewController *)gallery urlForPhotoSize:(FGalleryPhotoSize)size atIndex:(NSUInteger)index
    {
        return [localImages objectAtIndex:index];
    }

    - (int)numberOfPhotosForPhotoGallery:(FGalleryViewController *)gallery
    {
        int num;

        num = [localImages count];

        return num;
    }

    - (FGalleryPhotoSourceType)photoGallery:(FGalleryViewController *)gallery sourceTypeForPhotoAtIndex:(NSUInteger)index
    {    
         return FGalleryPhotoSourceTypeLocal;
    }
    //Delegate method ends here

// My method to show gallery with my images
-(void)ShowGallery
{
    localImages = [[NSMutableArray alloc]init];    

     NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [paths objectAtIndex:0];
NSString *dataPath = [documentsDir stringByAppendingPathComponent:chatWithUser;
NSString *msgsColumn;

    //database query to fetch all images name and then
    while([results next])
    {
        msgsColumn = [results stringForColumn:@"msgs"];
        if([[[msgsColumn componentsSeparatedByString:@"."]objectAtIndex:1]isEqualToString:@"jpg"])
        {
            [localImages addObject:[dataPath stringByAppendingPathComponent:msgsColumn]];
        }
    }

    [database close];

    localGallery = [[FGalleryViewController alloc]initWithPhotoSource:self];

    [self.navigationController pushViewController:localGallery animated:YES];     
}
对于图像路径,我使用了stringByAppendingPathComponent,但我也尝试了stringByAppendingString来指导图像驻留在documents目录中,但没有任何效果


请帮我找出哪里出了问题。

我找到了解决方案,现在就在这里