Receiving touch events on more then one UIView simultaneously

后端 未结 2 1245
清歌不尽
清歌不尽 2021-01-01 07:10

I have a bunch of UIViews stacked one upon the other(not nested). I want them all to react to touch, but it seems that the topmost view obscures the views benea

2条回答
  •  醉梦人生
    2021-01-01 07:27

    Touches are sent to a single view. That view can then optionally pass them up the responder chain. If you want to handle touches to a collection of views you should have them forward those events up to the next responder and have a common parent of all of them (or their view controller since the controller is also part of the responder chain) handle those touches.

    https://developer.apple.com/library/mac/documentation/General/Devpedia-CocoaApp-MOSX/Responder.html

提交回复
热议问题