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

发布于 2024-11-15 19:08:26 字数 775 浏览 2 评论 0原文

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

[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 上的触摸。

主要应用程序是在平移中显示图像,当用户单击它时,包含该图像的网页应在下一个网页视图中加载。 我怎样才能实现这个目标?

I am trying to animate an image using following code:

[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];

I have UIScrollView which has one subview UIImageView and fimage is that UIImageView. But when i try to detect the touch on it i am not able to do that. Can any one help me? Is is possible to detect touches on UIScrollView.

The main application is to display images in panning and when user clicks on it the web page containing that image should be loaded in next web view.
How can I achieve this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尾戒 2024-11-22 19:08:26

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

检查以了解如何操作在 UIWebView 对象中加载图像。至于平移,如果您还没有尝试过,您应该尝试 UIPanGestureRecognizer

I tested your code and it seems to be working without hiccups. It is likely that the image view object has its userInteractionEnabled set to NO. Set it to YES to make touches work.

Check this to see how you can load images in UIWebView object. As for panning, you should try out the UIPanGestureRecognizer if you aren't already.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文