Touch in UIScrollview?

I use ScrollviewDelegateProtocol in the viewcontroller, but I use Custom UIView(UIImageview)in this user view.

For some reason touchMovednot called. Anyone have any ideas why this is (not) happening?

+3
source share
1 answer

If scrolling is enabled in UIScrollView, events touchMoveddo not apply to the contents of the scroll view. As a workaround that depends on what you want to achieve. In my application, I just needed to drag and drop the object inside UIScrollView, and I did the following in touchView handlers for the content:

  • touchesBegan: , , , . - UIScrollView
  • , , touchesMoved, "" .
  • touchesEnded: .

- , UIScrollView (. hitTest:withEvent:)

+7

Source: https://habr.com/ru/post/1739318/


All Articles