2

In my app, I have added an UITableView over a ScrollView. I have disabled scrolling in table view. So, only the scrollView Scrolls, I have adjusted the scroll view content Size with the tableView Frame. So, I can access all the cells.

Consider, there are 5 rows visible in the screen, if I tap any of the row, the didSelectRowAtIndexPath method gets called. If I scroll down, say to 6th cell and tap on it. The method doesnt gets called.

Same issues happens with UIcollectionView.

The reason why I have added so is. When I scroll the Scroll View, a view in that should get fixed in the top and the tableView behind it should go on scrolling. You might have seen in many of the apps in Android. So, I have used the ScrollView didScroll delegate to get the offset position. As per it, I will make the view to be fixed and vice versa.

1 Answers1

0

Make the height of UITableView same as the content height of table. Then set the content size of UIScrollView as the height of UITableView

Here is a brief example to demonstrate

CGRect rect = tblTopics.frame;
rect.size.height = tblTopics.contentSize.height;
tblTopics.frame = rect;

self.scrlVwFacultyDtl.contentSize = CGSizeMake(self.scrlVwFacultyDtl.frame.size.width, tblTopics.frame.size.height);

In the above example the tblTopics is the instance of UITableView and scrlVwFacultyDtl is the instance of UIScrollView

hope it will help you..

Andolasoft Inc
  • 1,296
  • 1
  • 7
  • 16