我在 UIScrollView 后面有一个 UIButton。卷轴的背景是透明的,按钮位于右下角。所以它是可见的。
问题是 UIButton 在滚动下方时不响应任何触摸事件。在这种情况下,它需要什么才能响应触摸事件?
谢谢
最佳答案
您应该使用 +touchesBegan 方法将触摸传递给下一个对象。
以下是您如何执行此操作的示例:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
printf("MyButton touch Began\n");
[self.nextResponder touchesBegan:touches withEvent:event];
}
下面是关于响应链的更多信息:
关于iphone - UIScrollView 后面的 UIButton,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7327423/