Disable scrolling UITableView on some cells

In iOS 6, I have a UITableView with disabling enabled for updating. In the upper cell, I have several custom controls that the user can interact by dragging and dropping a round slider (see. This example ). See screenshot ...

enter image description here

The control needs a tag, and dragging and dropping the slider pointers needs to be dragged, but it can be difficult to capture, since frequent hits fall on the background element of the cell, causing the table to be dragged.

I would like to disable the default scrolling of a table if a click event occurs anywhere in these controls. Two options that I can come up with:

  • disable table drag and drop for any event in this top cell
  • make sure that the controls handle events over a larger area, especially in parts where they have a transparent background.

Any suggestions on how to achieve any of them?

Thank!

+5
source share
1 answer

I used a subclass UIControland redefined these functions:

override func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool { }

override func endTracking(_ touch: UITouch?, with event: UIEvent?) {}

override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {}

It is great for me in this circle slider style.

If still not working, you can try turning on / off the scrolling of the View table in the above methods.

tableView.isScrollEnabled = false / ture
0
source

All Articles