2014-10-31 65 views
0

我做了一个应用程序,包含UICollectionview和ImageView,当我选择UICollectionViewCellImage然后它显示在UIImageview中,我添加一个UIBUtton到UIImageView返回到UICollectionview,但是当我回到UICollectionview它是未响应。请给我解决方案。UICollectionView没有响应时CollectionView单元格被选中

我的代码是

- (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。 如果有SolutionPossible那么请给我解决方案。

回答

0

我不完全明白这个问题。我想,你可以试试这个:

self.collectionView.userInteractionEnabled = true. 

如果你找到了解决方案,请张贴它。它可能是有用的

相关问题