- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
UICollectionViewFlowLayout *myLayout=[[UICollectionViewFlowLayout alloc]init];
myLayout.scrollDirection=UICollectionViewScrollDirectionHorizontal;
[self.collectionView setCollectionViewLayout:myLayout animated:YES];
UIImageView *recipeImageView=[[UIImageView alloc]initWithFrame:CGRectMake(35, 100, 250, 250)];
recipeImageView.layer.borderColor = [UIColor redColor].CGColor;
recipeImageView.layer.borderWidth = 8.0;
[self.view addSubview:recipeImageView];
NSString *selectedRecipeImageFileName = [self.getName objectAtIndex:indexPath.row];
UIImage *selectedRecipeImage = [UIImage imageNamed:selectedRecipeImageFileName];
recipeImageView.image = selectedRecipeImage;
}
我正在使用集合视图。首先,我按下任何图像,然后在视图上显示UIImageView
。如果我按下其他图像,那么该图像将再次出现。此时它正常工作。之后,我想拥有它,所以如果我按下空白处,然后图像视图隐藏。请给我一些想法。如何在UICollectionView中按下视图时关闭UIImageView
使用UIGestureRecognizerDelegate后,哪个委托方法将会调用 – 2014-09-24 06:15:03
我编辑了我的答案,请检查。 – teach 2014-09-24 07:18:04
好的,谢谢bro非常感谢。非常感谢 – 2014-09-24 08:31:07