6

Does anyone know what is going on with this problem? My cell stop swiping because of this.

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

Help !!!

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Piotr
  • 101
  • 7
  • 1
    Care to share some code? – Orkhan Alikhanov Sep 27 '17 at 07:20
  • 1
    It isn't anything special, only VC with UItableView. Cell swiping I created using gesture recognizer implemented in subclass of UITableViewCell and works fine, problem starting when this log is showing. – Piotr Sep 27 '17 at 07:57

3 Answers3

2

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

Piotr
  • 101
  • 7
2

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

AND using addSubview to display it. This problem will occur.

My solution is using "addSubview:cell.contentView" BUT NO "addSubview:cell"

  • I did the same but not working, `tableViewCell.contentView.addSubview(tableViewCell.webView)` do you have any more suggestion ? – Abhishek Mitra Mar 12 '18 at 19:33
1

I already found solution even with creating swipe cell using gesture recognizer, in my case the problem ("Unexpected nil index path in _shouldShowMenuForCell:, this should never happen. ") was appearing because of 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 of: Capturing touches on a subview outside the frame of its superview using hitTest:withEvent:

Piotr
  • 101
  • 7