简体   繁体   English

将触摸从UIImageView传递到Superview

[英]Passing touches from UIImageView to superview

I have four UIImageViews placed on a circular UIView . 我有四个放置在圆形UIView上的UIImageViews Dragging the UIView rotates the view. 拖动UIView旋转视图。 But when I drag the UIImageView, the rotation does not occur. 但是,当我拖动UIImageView时,不会发生旋转。 The UIImageView is eating the touches. UIImageView正在吃东西。

I subclassed the UIImageView and tried this: 我将UIImageView子类化,并尝试了以下方法:

- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    [self.superview touchesMoved:touches withEvent:event];
    [super touchesMoved:touches withEvent:event];
}

That doesn't seem to solve the problem. 那似乎并不能解决问题。 I tried disabling touches on the UIImageView - [imageView setUserInteraction:NO] . 我尝试禁用对UIImageView触摸- [imageView setUserInteraction:NO] That doesn't solve the problem either. 那也不能解决问题。 I know there are similar questions been asked. 我知道有人问过类似的问题。 But none seem to solve my problem. 但是似乎没有人能解决我的问题。

Thanks. 谢谢。

尝试在UIImageView上将userInteractionEnabled设置为NO ,这样可以防止他们消耗触摸。

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

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