旋转手势:我可以用一个手势同时旋转两个图像

时间:2013-09-14 14:31:50

标签: ios uiimageview gesture

我很擅长为iOS开发,所以我的问题是:如果我有两个图像,我想同时在手势上操纵,这样它们就可以在同一个方向上同时移动,这可能吗?

2 个答案:

答案 0 :(得分:0)

您需要区分被触摸的图像位置和移动到的位置(触摸位置)。比如说图像在{25,50}并且它将被移动到{30,55},差异是{5,5}。现在您知道可以通过添加相同的差异来修改其他图像。

答案 1 :(得分:0)

这是我目前的代码

AppDelegate * app =(AppDelegate *)[[UIApplication sharedApplication] delegate];

float y = myScroll.contentOffset.y + recipeImageView.frame.origin.y;
float x = myScroll.contentOffset.x + recipeImageView.frame.origin.x;

NSLog(@"x Position is :%f , y position is : %f",x,y);

UICollectionViewCell *cell=[[UICollectionViewCell alloc]initWithFrame:CGRectMake(10, (self.view.frame.size.height-imageHeight)/2-50, imageWidth , 649)];

NSIndexPath * indexPath = [_collectionView indexPathForCell:cell];

recipeImageView = [[UIImageView alloc] initWithFrame:CGRectMake(x, y, imageWidth , 649)];

recipeImageView.image = [UIImage imageNamed:[[app phhhhh] objectAtIndex:indexPath.row]];     recipeImageView.multipleTouchEnabled = YES;     recipeImageView.userInteractionEnabled = YES;

[cell addSubview:recipeImageView];   
相关问题