1

So I have a UITableView nested inside a UITableViewCell, like:

  • UITableView baseTable

    • UITableViewCell baseTableCell0

      • UITableView subTableView
        • UITableViewCell subTableViewCell
      • UIView subView
    • UITableViewCell baseTableCell1

      • UICollectionView subCollectionView
        • UICollectionViewCell subCollectionViewCell

subView has a UITapGestureRecognizer connected, acts like a button subTableView and subCollectionView should receives touch events and perform didSelectRowAtIndexPath

On iOS 8 this works fine, but when i'm testing on ios 7 the cells in subTableView and subCollectionView does not receives touch event anymore, the touch event is sent to [baseTableView tableview... didSelectRowAtIndexPath]. However the UITapGestureRecognizer on subView can still receive touch event.

  • update: ios 6 has this problem as well, so it only works on ios 8 so far
halfer
  • 19,824
  • 17
  • 99
  • 186
Max One
  • 73
  • 1
  • 9

2 Answers2

1

Use this code on tab gesture object

tap.cancelsTouchesInView = NO;  
Nishant Gupta
  • 131
  • 15
  • sorry, i should have mentioned, the tap gesture recognizer is working fine, my problem was that the subTableView and subCollectionView are not receiving touch events – Max One Jul 27 '15 at 08:44
  • yes i know bro this property allow to touch on all subview in which you add tab gesture i have same problem and it resolve that .... – Nishant Gupta Jul 27 '15 at 09:12
  • the view with the tap gesture recognizer is not subview of subTableView or subTableViewCell, is subview of baseTableViewCell – Max One Jul 27 '15 at 09:22
0

Try changing the background color of your UITableView, UITableViewCell and UIView, this way you can see if your child view is not exceeding your parent view, if it is the case your child view is not going to receive touch events. Then either adjust Parent to show child fully or adjust child to remain in the parent boundary.

Hope it helps!

EDIT:

May be passing touch events to subviews can help.

Community
  • 1
  • 1
NeverHopeless
  • 11,077
  • 4
  • 35
  • 56