Unexpected nil index path in _shouldShowMenuForCell

Does anyone know what is happening with this problem? Because of this, my cell stop.

[Assert] Unexpected nil index path in _shouldShowMenuForCell: this should never be. Cell; baseclass = UITableViewCell; frame = (0 97.5; 375 130); alpha = 0; hidden = YES; autoresize = W; gestureRecognizers =; layer =>

Reference!!!

+4
source share
3 answers

I change the swiping method from gestureRecognizer to ScrollView and everything works fine.

+1
source

If your cell is created - [[[NSBundle mainBundle] loadNibNamed: owner nibName: self options: nil] lastObject];

And using addSubview to display it. This problem will arise.

"addSubview: cell.contentView", "addSubview: cell"

+1

I already found a solution even when creating a scroll cell using a gesture recognizer, in my case there is a problem ("Unexpected index path nil in _shouldShowMenuForCell: this should never happen.") Appeared due to this function:

override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
        for subview in self.subviews.reversed() {
            if subview.frame.contains(point) {
                return subview
            }
        }

        return super.hitTest(point, with: event)
}

tip: Working solution: Capturing strokes on a preview outside of its supervisor using hitTest: withEvent:

0
source

Source: https://habr.com/ru/post/1686454/


All Articles