开发者

UITableView and UIGestureRecogniser

开发者 https://www.devze.com 2023-03-28 19:44 出处:网络
I have a UITableView with normal vertical scrolling. I want to add a UISwipeGestureRecnogiser to it (or somewhere connected in the view hierarchy).

I have a UITableView with normal vertical scrolling.

I want to add a UISwipeGestureRecnogiser to it (or somewhere connected in the view hierarchy).

I've done this, but the vertical tolerance on my gesture recogniser is pretty small. So I have to get my horizontal swipe p开发者_Python百科retty straight, otherwise the UITableView takes over and scrolls vertically. This is pretty annoying for the user.

Has anyone got any suggestions on how to better handle this? Maybe putting a UIView on top of my table view that handles the gesture, but if it fails - somehow pass the event to my table View.....


I ended creating my own gesture recogniser - following the example from the event handling guide for iOS.

I had more control over vertical tolerance using the old touchesMove and touchesBegan.

It still wasn't perfect, but it was a lot better and after testing on a few people, I could see there the swiping was less error prone.

0

精彩评论

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

关注公众号