动画图像视图时检测触摸的困难
我正在尝试使用以下代码对图像进行动画处理:
[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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我测试了你的代码,它似乎可以正常工作。图像视图对象的
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 toNO
. Set it toYES
to make touches work.Check
this
to see how you can load images inUIWebView
object. As for panning, you should try out theUIPanGestureRecognizer
if you aren't already.