Normally, the UITableView is something like this:
[ cell 1 ]
[ cell 2 ]
[ cell 3 ]
[ cell 4 ]
But I want to mak
I recommend EasyTableView and PSTCollectionView, they are great horizontal tableview project on github that are stared a lot.
EasyTableView can do horizontal tables
if you want use textLabel, you can use this:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
}
cell.textLabel.frame = CGRectMake(0,0, cell.frame.size.width , cell.frame.size.width); // it's very important!!!You must set frame of textLabel, because you can have a problems with displaying you table;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
CGAffineTransform trans = CGAffineTransformRotate(CGAffineTransformIdentity, M_PI_2);
cell.textLabel.transform = trans; // rotating you caption;
cell.textLabel.text = @"tra-tata";
cell.textLabel.textAlignment = UITextAlignmentCenter;
return cell;
}
It isn't too terribly difficult to build up something similar to UITableView in code on your own. If you can find it, the expert-level Scroll Views session from WWDC09 had some awesome sample code.
I don't think there is a available control which will enable you to do this. Your best bet is to roll your own.
In a nutshell you'll want to subclass UIScrollView, which will allow you to have more cells than you have room for on screen. It will also sort out all your swiping behaviour.
Into this scroll view you want to put a set of cells - I'd subclass UIView rather than trying to force UITableViewCell play nice with your Scroll View for these.
This is just a simple example of how to approach the problem. How many of the features of UITableView are you hoping to replicate?
Use a UIViewController with a UIView, add the UITableView of your table to the controller view, then in terms of code is just one line:
- (void)viewDidLoad
{
[super viewDidLoad];
// horizontal table
// -90 degrees rotation will move top of your tableview to the left
myTableView.transform = CGAffineTransformMakeRotation(-M_PI_2);
//Just so your table is not at a random place in your view
myTableView.frame = CGRectMake(0,0, myTableView.frame.size.width, myTableView.frame.size.height);
...