mercredi 24 juin 2015

IOS download image, tableViewCell and Array

I have an Array. Inside my array have 8 object seriated:

 - text
 - text
 - link Url Image.
 - link Url Image.
 - text
 - link Url Image.
 - link Url Image.
 - text

I had downloaded all image and save to document folder. And now, How can I get all image from document folder and show in tableViewCell seriated same myArray?

I used this code to get all image from document folder.

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *myPath = [paths objectAtIndex:0];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *directoryContents = [fileManager contentsOfDirectoryAtPath:myPath error:nil];
NSMutableArray *subpredicates = [NSMutableArray array];
            [_arrMessageFree addObject:[NSPredicate predicateWithFormat:@"SELF ENDSWITH '.png'"]];
            [_ar addObject:[NSPredicate predicateWithFormat:@"SELF ENDSWITH '.jpg'"]];
NSPredicate *filter = [NSCompoundPredicate orPredicateWithSubpredicates:subpredicates];

NSArray *onlyImages = [directoryContents filteredArrayUsingPredicate:filter];

But, I cannot show both text and image seriated in myArray.

See more ..

Aucun commentaire:

Enregistrer un commentaire