0

我在 UIWindow 上使用 UIimageview。我想处理该 Imageview 的触摸事件,但我无法做到。

当我在 UIview 上使用 UIimageView 时,我们可以使用 touchBegan、touchEnded 但是当它在 UIWindow 而不是 UIView 上时如何处理它。

谢谢..

4

2 回答 2

2

如果你只想处理水龙头,你必须设置,

imageView.userInteractionEnabled = YES;

默认情况下UIImageViewuserInteractionEnabled属性设置为NO。你可以给它添加一个点击手势识别器,

UITapGestureRecognizer *tgr = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(anyMethod)];
[imageView addGestureRecognizer:tgr];
[tgr release];

如果要移动图像,可以使用UIPanGestureRecognizer

于 2011-07-09T04:38:37.487 回答
0
- (void)sendEvent:(UIEvent *)event

试试这个功能

于 2011-07-09T04:47:02.280 回答