0
我有一个UITableView
它包含一个UIImage
和标题每个单元格。我从我的数据库中获取图像,其中包含通过ALAssetsLibrary
生成的图片的路径。问题是每当我将照片包含在表格中时,我都无法选择该单元格。任何帮助,将不胜感激UITableView单元格不会选择
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIndentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIndentifier];
if (!cell) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIndentifier];
}
Person *aPerson = [arrayOfPerson objectAtIndex:indexPath.row];
UIImage *background = [self cellBackgroundForRowAtIndexPath:indexPath];
UIImageView *cellBackgroundView = [[UIImageView alloc] initWithImage:background];
cellBackgroundView.image = background;
cell.backgroundView = cellBackgroundView;
UILabel *myLabel = (UILabel *) [cell viewWithTag:101];
myLabel.text = aPerson.title;
NSString *stPath = [NSString stringWithFormat:@"%@", aPerson.photo];
NSURL *urlNow = [NSURL URLWithString:stPath];
ALAssetsLibrary* assetslibrary = [[ALAssetsLibrary alloc] init];
[assetslibrary assetForURL:urlNow resultBlock:^(ALAsset *imageAsset) {
ALAssetRepresentation *r = [imageAsset defaultRepresentation];
UIImageView *myImageView = (UIImageView *)[cell viewWithTag:100];
myImageView.image = [UIImage imageWithCGImage: r.fullResolutionImage];
//[cell.contentView addSubview:myImageView];
[self.tableView reloadData];
} failureBlock:nil];
return cell;
你是什么意思的“不能选择细胞”?你有没有实现didSelectRowAtIndexPath? – Mike