Reputation: 14113
I have too many columns in my table and too much data too. For that reason I need to scroll my UITableView
both vertically and horizontally. Is there a direct way to do so or I need to go through sources like Easy tables?
Upvotes: 3
Views: 4403
Reputation: 7796
Here is a trick to do both vertical and horizontal scrolling with a UITableView.
Playing with width and contentsize to make it work: https://stackoverflow.com/a/41230797/860488
Upvotes: 0
Reputation: 11
I have a similar situation: a lot of columns and rows, the tableView needs to be horizontally scrollable. My solution is like that: predefine a column header with width same as the desired tableView, say 537
top view (320 x 455)
+ scroll view (320x455), content size = (537x455)
+ view as a container (537 x 455)
+ column header (0, 0, 537, 44)
+ tableView (0, 44, 537, 455-44)
Create a function to compute these numbers and reattach the frames to each object after tableview reload, call this function
Upvotes: 1
Reputation: 3020
You can use an UIScrollView and then inside add the UITableView. This UIScrollView will have the same size that your UITableView have now, but the UIScrollView contentSize property will have the same height but it would have a greater width.
Upvotes: 6