繁体   English   中英

动画图像视图时检测触摸困难

[英]Difficulties in detecting touch while animating an imageview

我正在尝试使用以下代码对图像进行动画处理:

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:40];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
CGAffineTransform rotate = CGAffineTransformMakeRotation(0.0);
CGAffineTransform moveRight = CGAffineTransformMakeTranslation(0, 0);
CGAffineTransform firstHalf = CGAffineTransformConcat(rotate, moveRight);
CGAffineTransform zoomIn = CGAffineTransformMakeScale(2,2);

CGAffineTransform transform = CGAffineTransformConcat(zoomIn, firstHalf);
fimage.transform = transform;
[UIView commitAnimations];

我有UIScrollView,其中有一个子视图UIImageView,而fimage是该UIImageView。 但是,当我尝试检测触摸时,我无法做到这一点。 谁能帮我? 可以检测UIScrollView上的触摸。

主要应用程序是在平移中显示图像,当用户单击它时,包含该图像的网页应在下一个Web视图中加载。 我该如何实现?

我测试了您的代码,它似乎正常运行。 图像视图对象的userInteractionEnabled设置为NO 将其设置为YES可以使触摸起作用。

选中this以查看如何在UIWebView对象中加载图像。 对于平移,如果尚未进行平移,则应尝试使用UIPanGestureRecognizer

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM