iOS开发手势为什么要进行参数转换
-(void)panAction:(UIGestureRecognizer*)setter{//_imageView.image=[UIImageimageNamed:@...
- (void)panAction:(UIGestureRecognizer *)setter
{
// _imageView.image = [UIImage imageNamed:@"a.jpg"];
//确定平移手势
UIPanGestureRecognizer *pan = (UIPanGestureRecognizer *)setter;
CGPoint point = [pan translationInView:_imageView];//参数转换 问题:为什么要进行参数转换
//视图本是 transform变化
_imageView.transform = CGAffineTransformTranslate(_imageView.transform, point.x, point.y);
//将视图重置
[pan setTranslation:CGPointZero inView:_imageView];
} 展开
{
// _imageView.image = [UIImage imageNamed:@"a.jpg"];
//确定平移手势
UIPanGestureRecognizer *pan = (UIPanGestureRecognizer *)setter;
CGPoint point = [pan translationInView:_imageView];//参数转换 问题:为什么要进行参数转换
//视图本是 transform变化
_imageView.transform = CGAffineTransformTranslate(_imageView.transform, point.x, point.y);
//将视图重置
[pan setTranslation:CGPointZero inView:_imageView];
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询