好奇怪的问题!
uitablecell中的uiimageview,添加了gesture recognizer,但是,再simulator里边,有的imageview响应,有的不响应。请问使怎么回事?
代码如下:
uitablecell中的uiimageview,添加了gesture recognizer,但是,再simulator里边,有的imageview响应,有的不响应。请问使怎么回事?
代码如下:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"cell";
if([indexPath section]==0){
return [tableView dequeueReusableCellWithIdentifier:@"loadcell" forIndexPath:indexPath];
}
else if([indexPath row]<self.data.count){
tablecellCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.userInteractionEnabled = YES;
[cell addGestureRecognizer:self.changeAlbumTap];
UILabel * label = (UILabel *)[cell.contentView viewWithTag:1];
[label setText:[self.data objectAtIndex:[indexPath row]]];
UIImageView * imageView = (UIImageView*)[cell.contentView viewWithTag:2];
[imageView setContentMode:UIViewContentModeScaleAspectFit];
[imageView setBackgroundColor:[UIColor grayColor]];
// [imageView setImageWithURL:[NSURL URLWithString:@"http://caipiao.tao3c.com/pages/index/imagesNew/element.png"]
// placeholderImage:[UIImage imageNamed:@"Default.png"]
// ];
UIImageView * biv = [[UIImageView alloc]init];
CGRect fbiv = CGRectMake(20, label.frame.origin.y+50, 60, 60);
biv.frame = fbiv;
[biv setImage:[UIImage imageNamed:@"Default.png"]];
biv.userInteractionEnabled = YES;
biv.multipleTouchEnabled = YES;
[biv setTag:[indexPath row]];
[biv addGestureRecognizer:self.refreshAlbumTap];
[cell addSubview:biv];
return cell;
} else {
return [tableView dequeueReusableCellWithIdentifier:@"loadcell" forIndexPath:indexPath];
}
}