0

My question is similar to a bunch of questions on stackoverflow (eg. swipe to delete in a UITableView which is embeded in a UIScrollView) I need to implement a swipe action on a table view cell for a tableview controller which is a custom view embedded in a scrollview. However, the swipe events are not working properly and I understand the problem is that the UIScrollView is eating up the events for the UITableView so I tried out a bunch of options.

1) I subclassed the UIScrollView with the touchesBegan, touchesEnd etc methods but they never seem to get hit.

2) I could get hits on scrollViewWillBeginDragging but I am not sure how to call the responder for the UITableViewController from this.

3) I implemented a gesture recognizer in the tableviewcontroller class but that also didn't help.

I am confused as to how to go about so some code in Swift 3 syntax would be really helpful.

Community
  • 1
  • 1
ssarangi
  • 602
  • 1
  • 10
  • 28
  • can you send screenshot for design of delete button ? – KKRocks Nov 17 '16 at 05:53
  • Its exactly similar to this. https://koenig-media.raywenderlich.com/uploads/2014/01/IMG_3743.png – ssarangi Nov 17 '16 at 05:55
  • The only difference being that the table view is embedded in a scrollview – ssarangi Nov 17 '16 at 05:55
  • this is do without scrollview . it is the default delete button for tableview . – KKRocks Nov 17 '16 at 05:57
  • I didn't understand your comment. – ssarangi Nov 17 '16 at 05:59
  • do you want to do this without scrollView ? because without scrollview you can do this . – KKRocks Nov 17 '16 at 06:00
  • Why is your table view in a scroll view? A `UITableView` already is a `UIScrollView`. – rmaddy Nov 17 '16 at 06:01
  • right... I want to do this with scrollview. Without the scrollview it already works. – ssarangi Nov 17 '16 at 06:01
  • @maddy - that's coz it's a composite vc which is a *sorta* tab bar and the scroll view actually implements the transition between the tabs. One tab in this is a tableview... – ssarangi Nov 17 '16 at 06:02
  • check this for your delete button : http://stackoverflow.com/a/29166246/3901620 – KKRocks Nov 17 '16 at 06:09
  • @KKRocks: thanks I already have this working. My problem is that the swipe action doesn't always work properly because sometimes the scrollview eats up the swipe action. I need a way to propagate the swipe action to the tableviewcontroller. That's what I am looking for. – ssarangi Nov 17 '16 at 06:13

0 Answers0