Uitableview Inside Uiscrollview Not Receiving First Tap After Scrollling

UITableView in UIScrollView not responding to first tap after scroll

As answered here, the correct solution (if you're not one to follow the rules) is to keep scrollEnabled set to YES on all embedded tableViews. This lets them handle the touches properly. But be sure to set bounces to NO on the embedded views to avoid weird scrolling behavior.

UITableView inside UIScrollView - Cell not clickable

Do the following thing:

yourView.clipToBounds = true

Now, if UITableView does not appears means your UIView is not same bigger to hold down UITableView.

Make sure that your UIView height is bigger to hold the contents in it and then try to tap on it.

Updated:

If you are using AutoLayout, then do the following thing.

  1. Give the fix height to UIView
  2. Take the outlet of height constraint of UIView
  3. Now, in viewDidLayoutSubviews change the constraint of UIView to UITableView contentSize height.

    self.heightConstraint = self.tableView.contentSize.height

Let me know, if this helps!

UITableView tap not working first time after constraints change

After trying to figure out a solution to this without result, we (me and a UX designer) decided to change the behaviour a bit.

So in the real scenario in the app I'm implementing this in, the table view is inside another view that has also a title label and some other views above the table view. We decided to add a pan gesture recognizer to this root view and disable the scrolling of the table view when the view has the min size. This way the pan gesture recognizer will take over whenever the user tries to drag anywhere inside the view (including the table view), so the expanding of the view works. And the tap in the cell still works.

When the view has the max height the table view scroll is enabled so the user can scroll. The downside of this approach is that when the user scrolls to the top of the table view and continues scrolling the view will not decrease the size. But he still has the option to drag it down by dragging any of the views above the table view. When dragging down in this way, only the size of the table view changes, and the content offset isn't, which is the root of the problem (changing both at the same time).

UITableView scrolling problems when inside a UIScrollView

Things I would check:

  1. Check your View Hierarchies - Is something being laid on top of your UITableView, causing it not to receive a tap?
  2. Are your UITableViews being disabled anywhere? I would set a breakpoint in tableView:didSelectRowAtIndexPath: and see if that method is being called.
  3. Check this post

I guess those aren't sure-fire answers but hopefully they'll help discover the problem!

Row selection doesn't work on first tap after scroll in a non-bouncing UITableView

After a lot more testing, I found that the problem happens when the table's contentOffset.y reaches maximum value or 0. So I created my own "bouncing effect" but on a much smaller scale by implementing scrollViewWillEndDragging:withVelocity:targetContentOffset: in the table view's delegate as follows:

-(void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
{
targetContentOffset->y = MAX(targetContentOffset->y -1, 1);
}

With that in place, the problem disappeared. It's a workaround but works like a charm!



Related Topics



Leave a reply



Submit