Ios 需要有关将下载图像显示为图库的帮助吗
在我的应用程序中,我从url下载图像并保存到应用程序文档目录中。现在我想将这些下载的图像显示为图像库。对于我正在使用的图像库,我可以对其进行配置,并成功地将其推送到导航控制器上,并且fGallery视图也可见,但它不显示我的图像,我为fGallery提供如下图像阵列 头文件Ios 需要有关将下载图像显示为图库的帮助吗,ios,Ios,在我的应用程序中,我从url下载图像并保存到应用程序文档目录中。现在我想将这些下载的图像显示为图像库。对于我正在使用的图像库,我可以对其进行配置,并成功地将其推送到导航控制器上,并且fGallery视图也可见,但它不显示我的图像,我为fGallery提供如下图像阵列 头文件 @interface myController <FGalleryViewControllerDelegate> @property (strong, nonatomic) FGalleryViewContr
@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目录中,但没有任何效果
请帮我找出哪里出了问题。我找到了解决方案,现在就在这里