开发者

How to Implement Swipe Gesture in Down Direction for UITableView?

开发者 https://www.devze.com 2023-03-12 18:21 出处:网络
I tried the following code: UISwipeGestureRecognizer *showBar = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(gestureShowBar:)];

I tried the following code:

UISwipeGestureRecognizer *showBar = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(gestureShowBar:)];
showBar.direction = UISwipeGestureRecognizerDirectionDown;
showBar.numberOfTouchesRequired = 2;
[self.tableview addGestureRecognizer:showBar];

with no luck! The tableview tends to scroll when I swipe is performed using two fingers. So, I tried disabling multi-touch on tableview and let the superview handle the gesture:

UISwipeGestureRecognizer *showBar = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(gestureShowBar:)];
showBar.direction = UISwipeGestureRecognizerDirectionDown;
showBar.numberOfTouchesRequired = 2;
[self.view addGestureRecognizer:showBar];

Again, it doesn't work! I really wonder why a tableview wil开发者_Go百科l respond to two finger swipe although multi-touch is not enabled!


this link describe how to implement pinch gesture in a table row u can adjust swipe gesture instead of it

check out the tableviewcontroller class where handle pinch method is there http://developer.apple.com/library/ios/#samplecode/TableViewUpdates/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010139

Good luck

0

精彩评论

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

关注公众号