开发者

How do you receive touches in views added to a subview

开发者 https://www.devze.com 2023-02-01 20:04 出处:网络
I have been adding several subviews (\"touch subviews\") to a scroll view which respond to touches. The touch delegate methods in each of these subviews all fire nicely.

I have been adding several subviews ("touch subviews") to a scroll view which respond to touches. The touch delegate methods in each of these subviews all fire nicely.

I have one sub开发者_Go百科view (bodyClock) which holds the main content of the scroll view and is the viewForZoomingInScrollView. In order for the "touch" subviews to zoom properly I find now that I have to add them the bodyClock subview instead of the scroll view. When I do this, however, the "touch subviews" no longer respond to touches.

I have tried all sort of things with first responder without any success. Any help pointing me in the right direction would be appreciated.


OK, I found my problem I had a subview acting as a time mask in the scroll view that I think was responding to touches. This became evident when I noticed that the touch subViews did not respond to touches while the mask was over them. Because the mask was a subview to the scroll view, it would move when zooming such that a touch subview in the bodyClock view would come out from underneath the mask and suddenly start working.

Moving the mask from the scroll view to the bodyClock subView along with the "touch subviews" fixed my problem. Now all the subviews scroll and zoom properly, and respond to touches.

0

精彩评论

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

关注公众号