Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView Not Scrolling

I have a tableview which will not budge when touched. It is very confusing to me. It is the most recently added subview (I checked - it is the last entry in my view's subviews array) and for some reason it just won't scroll up or down. If I tap multiple fingers wildly on the tableview it will one in a while highlight the cell under one of my fingers, but it will not scroll even a little. I have set the number of rows to 100 (many more than are visible on screen) and I have set the 'bounces', 'scrollEnabled', and 'userInteractionEnabled' properties to YES.

I know that I have not provided much to go on here, but if anyone could at least give some tips on how to go about debugging this I would be very grateful. Can I log from within the tableView gestureRecognizer handling method? Can I test where my touches are going?

Please help!

Thanks.

like image 921
jeremyabannister Avatar asked Jan 10 '23 01:01

jeremyabannister


2 Answers

A TableView is basically a specialized ScrollView. If it's not scrolling, it seems to me it could be one of two things. Either something is on top of the TableView and is capturing the gesture events before the TableView can get them, or You have set the bounds and contentSize incorrectly. For a TableView or ScrollView, the bounds of the view should be the visible area, and the contentSize (should be handled by the TableView without you needing to do anything) is the size of all the cells in the Table.

So I would check the bounds of the table view and make sure you are setting that to the contentSize, since that would cause it nor to scroll.

Just to make sure it's on the top, try calling

[view bringSubviewToFront:tableView];
like image 179
wottle Avatar answered Jan 22 '23 23:01

wottle


In my case tableview "User Interaction" was disabled. I just enabled it & works.

like image 30
Linkon Sid Avatar answered Jan 23 '23 01:01

Linkon Sid