开发者

Cannot pass UITouch behind scrollview without disabling scrollview user interaction

开发者 https://www.devze.com 2023-01-07 21:55 出处:网络
I subclassed uiscrollview and over开发者_StackOverflow中文版rode the touch began method to pass touch events to a button object behind the scroll view(the scroll view is transparent).For some reason,

I subclassed uiscrollview and over开发者_StackOverflow中文版rode the touch began method to pass touch events to a button object behind the scroll view(the scroll view is transparent). For some reason, only if user interaction of the scrollview is disabled does the event get passed through. Does anyone know how to pass events up the responder chain with scroll view without disabling the user interaction?

Thanks, David


Yeah—override the scroll view's -hitTest:withEvent: method. You can check the position of the touch that way and pass it through to another view, e.g. your button. There're some notes on how to do that in the documentation here.

0

精彩评论

暂无评论...
验证码 换一张
取 消