开发者

recognize swipe gesture on UITableviews inside a UIScrollView with paging enabled

开发者 https://www.devze.com 2023-04-08 19:50 出处:网络
Edit: I\'ve begun implementing since I had first asked the question, so I\'ll rephrase the question with updated.

Edit: I've begun implementing since I had first asked the question, so I'll rephrase the question with updated.

I've set up a UIScrollView with a UIPageControl and a series of UITableviews as subviews. It works except for one problem: the subviews are each tableviews with horizontal swipe gestures on the table (the purpose of this swipe is to slide a cell and reveal a menu underneath the cell). They don't work unless I disable scrolling on the UIScrollView. But I still need a user to be able to swipe the scroll开发者_如何学编程 view outside when swiping outside the table.

Any guidance on how I can achieve this effect (swipe inside the table picked up by the table, swipe outside the table picked up by the scroll view).

Original: I'd like to set up a series of UITableviews horizontally in a UIScrollView with paging enabled. The tableviews will use a horizontal swipe gesture recognizer (to slide the cell to the side and reveal a submenu). And ideally horizontal swiping on the scroll view outside of a table (e.g. on the top of the scroll view) will cause UIScrollView to page to the next table.

Will the two swipe gestures work the way I hope? Or will the UIScrollView interfere? If so how would you correct it?

Any guidance would be great.


Here's what I'm going with so far:

  1. ScrollView scrolling remains disabled.
  2. When handling swipe gesture on tableView, added this test: if locating the cell that the swipe was over returns nil, then invoke a scroll of the UIScrollView to the next page, and update currentPage of the PageControl object.

This works well enough, thought this way I'm missing the very real-time scrolling of having the UIScrollView sense swipe touches (in another words, if I swipe just a little bit and stop, the view still pages).

Still would love to hear a better solution from the SO community.

Regards

0

精彩评论

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

关注公众号