我的代码是
- (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。 如果有任何解决方案,那么请给我解决方案。
答案 0 :(得分:0)
我不是100%了解这个问题。我想,你可以试试这个:
self.collectionView.userInteractionEnabled = true.
如果您找到了解决方案,请发布。它可能很有用