选择CollectionView单元格时,UICollectionView不响应

时间:2014-10-31 05:06:11

标签: ios uicollectionview uicollectionviewcell

我创建了一个包含UICollectionview和ImageView的应用程序,当我选择UICollectionViewCellImage然后它是在UIImageview中显示并且我将UIBUtton添加到UIImageView中以返回到UICollectionview但是当我回到UICollectionview时它没有响应。请给我解决方案。

我的代码是

- (void)viewDidLoad
{
self.zoomImage.hidden=TRUE;
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
self.zoomImage.hidden=FALSE;
NSDictionary *dict = [self.imagesa objectAtIndex:indexPath.item];
NSString *img=[dict valueForKey:@"link"];
[self.zoomImage sd_setImageWithURL:[NSURL URLWithString:img]];
self.imagecollection.hidden=TRUE;
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
[btn setFrame:CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.height)];
[btn addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
}
-(void)buttonPressed:(UIButton *)button
{
self.imagecollection.hidden=FALSE;
self.zoomImage.hidden=TRUE;
}

这里imagecollection是我的UICollectionView,Zoomimage是UIImageView。 如果有任何解决方案,那么请给我解决方案。

1 个答案:

答案 0 :(得分:0)

我不是100%了解这个问题。我想,你可以试试这个:

self.collectionView.userInteractionEnabled = true. 

如果您找到了解决方案,请发布。它可能很有用