14

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?

Community
  • 1
  • 1
Dilshan
  • 3,231
  • 4
  • 39
  • 50

6 Answers6

5
CGRect frame = tblView.frame;
tblView.transform = CGAffineTransformRotate(stressTblView.transform, M_PI / 2);
tblView.frame = frame;
John John
  • 71
  • 2
  • 5
5

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

This should solve your problems.

Edwin
  • 3,812
  • 2
  • 21
  • 16
5

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.

competent_tech
  • 44,465
  • 11
  • 90
  • 113
1

I don't think you can make a UITableView scroll horizontally. My suggestion would be to use an UIScrollView. UIScrollView is a super class of UITableView and gives you the scrolling behavior you expect from a UITableView. What you don't get is the table cell management that makes UITableView so convenient. Hence, you have to manage your own content. It is a little more work, but you get more control.

Jayesh Thanki
  • 2,037
  • 2
  • 23
  • 32
fsaint
  • 8,759
  • 3
  • 36
  • 48
1

What you want to do is use a UIScrollView and fill it left-to-right with "cell"-styled views.

Srikar Appalaraju
  • 71,928
  • 54
  • 216
  • 264
Dan Ray
  • 21,623
  • 6
  • 63
  • 87
0

I don't think that scroll horizontally is a good idea and probably violates the Apple's HIG.

Table view should not necessarily provide all the information but rather just some of the most important information, to view the information that requires a lot of space I suggest you do a detail view.

Luca Bernardi
  • 4,191
  • 2
  • 31
  • 39