嗨我试图显示位置,强度,日期和图像的数组。我在数组中只有2个值,但是在第2行的tableview单元格中出现了2个图像。
请检查图像,您可以看到显示两张图像的同一行。
这是我的代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"Cell";
cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
cell = [[BVHistoryTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:simpleTableIdentifier];
}
cell.imgView.layer.masksToBounds=YES;
cell.imgView.layer.cornerRadius=9.0;
ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset)
{
rep = [myasset defaultRepresentation];
iref = [rep fullResolutionImage];
if (iref) {
largeimage = [UIImage imageWithCGImage:iref];
cell.imgView.image = largeimage;//Display image
}
};
ALAssetsLibraryAccessFailureBlock failureblock = ^(NSError *myerror)
{
NSLog(@"Can't get image - %@",[myerror localizedDescription]);
};
asseturl = [NSURL URLWithString:[img objectAtIndex:indexPath.row]];
library = [[ALAssetsLibrary alloc] init] ;
[library assetForURL:asseturl
resultBlock:resultblock
failureBlock:failureblock];
// cell.imageView.image=[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[img objectAtIndex:0]]]];
cell.location.text = [latitude objectAtIndex:indexPath.row];
cell.intensity.text=[intensity objectAtIndex:indexPath.row];
cell.dates.text=[date objectAtIndex:indexPath.row];
return cell;
}