Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Horizontal scrolling UITableView [duplicate]

Possible Duplicate:
Horizontal UITableView

I need to make a UITableView horizontally scrollable. I have a custom table with width of 600 and as this is too larger. That table needs to be scrollable. How do I do this?

like image 514
Dilshan Avatar asked Jan 17 '11 11:01

Dilshan


People also ask

Can UITableView scroll horizontal?

You can add a UITableView to a UIScrollView and have it scroll horizontally.

How do I make my UICollectionView scroll horizontal?

You need to reduce the height of UICollectionView to its cell / item height and select " Horizontal " from the " Scroll Direction " as seen in the screenshot below. Then it will scroll horizontally depending on the numberOfItems you have returned in its datasource implementation.


2 Answers

have a look at this https://github.com/alekseyn/EasyTableView

This should solve your problems.

like image 191
Edwin Avatar answered Sep 21 '22 12:09

Edwin


For anyone who runs across this question, contrary to some of the other advice provided, horizontal scrolling of a UITableView is possible and is not a violation of the HIG. If it was, why would Apple provide the ability to scroll horizontally at all?

The way to get this to work correctly is to only set the ContentSize, not the FrameSize. I am a MonoTouch programmer, so I am not sure what the exact equivalent in objective-c is, but the way we address this is to create a custom class inherited from UITableView and override the LayoutSubviews method. In this method, we calculate and set the current ContentSize.

This approach catches all of the potential cases that we have found where the ContentSize could be reset, including rotating the device, scrolling, and zooming.

like image 35
competent_tech Avatar answered Sep 18 '22 12:09

competent_tech