I have stored the videos and the thumbnail images of the videos in Documents folder. And I have given the path in plist. In plist I took an array and I added directories to the array. And in the dictionary I stored the image path
/Users/srikanth/Library/Application Support/iPhone Simulator/User/Applications/9E6E8B22-C946-4442-9209-75BB0E924434/Documents/image1
for key imagePath.
for video
/Users/srikanth/Library/Application Support/iPhone Simulator/User/Applications/9E6E8B22-C946-4442-9209-75BB0E924434/Documents/video1.mp4
for key filePath.
I used following code but it is not working. I am trying only for images. I need the images to be loaded in the table in each cell.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
[cell setAccessoryType:UITableViewCellAccessoryDetailDisclosureButton];
UIImageView *image2;
image2.frame = CGRectMake(0.0f, 0.0f, 80.0f, 80.0f);
image2.backgroundColor = [UIColor clearColor];
}
NSDictionary *dictOfplist = [cells objectAtIndex:indexPath.row];
NSString *path = [dictOfplist objectForKey:@"imagePath"];
NSLog("path: %@", path);
return cell;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = @"Library";
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Close" style:UIBarButtonItemStyleBordered target:self action:@selector(close:)];
NSString* plistPath = [[NSBundle mainBundle] pathForResource:@"details" ofType:@"plist"];
contentArray = [NSArray arrayWithContentsOfFile:plistPath];
cells = [[NSMutableArray alloc]initWithCapacity:[contentArray count]];
for(dCount = 0; dCount < [contentArray count]; dCount++)
[cells addObject:[contentArray objectAtIndex:dCount]];
}
I got the path of the images are from the plist.
But, how can I extract the image from the path.
The output od NSLog: is
path: /Users/srikanth/Library/Application Support/iPhone Simulator/User/Applications/9E6E8B22-C946-4442-9209-75BB0E924434/Documents/snook.jpg
How can I get the image from it and store in cell.imageView.image ?
How can I make this work.
Thank you.