简体   繁体   English

将触摸传递给UIView

[英]Passing touches to a UIView

I have one view that has 2 sub views, let's call it a parent view. 我有一个具有2个子视图的视图,我们称其为父视图。 Those 2 sub views (let them be A and B), overlap, A is covering a portion of B. B view has some buttons on it, one of which is covered by A. Since A background color is clear color, user can see that button, and might want to press it, but alas he can't. 这两个子视图(让它们分别为A和B)重叠,A覆盖了B的一部分。B视图上有一些按钮,其中一个被A覆盖。由于A背景色是透明色,用户可以看到该按钮,可能要按一下,但是可惜他不能。

In normal mode, if A was sub view of B, i could do something like this: 在正常模式下,如果A是B的子视图,我可以做这样的事情:

- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

   // pass touches to next responder in chain
   [self.nextResponder touchesBegan:touches withEvent:event];
}

But since that isn't a case how can i pass that touch to B? 但是既然不是这种情况,我该如何将这种接触传递给B?

尝试这个

[[self view] bringSubviewToFront:subview_B];

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

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