Reputation: 77
I need to do a horizontal scroll in my table view and I search for all the Google and I don't find anything, I do that
CGRect tableFrame = CGRectMake(15, heightView-360, widthView+50, heightView-200);
UITableView *tableView = [[UITableView alloc]initWithFrame:tableFrame style:UITableViewStylePlain];
tableView.layer.cornerRadius=7;
tableView.rowHeight = 40;
tableView.sectionFooterHeight = myData.count;
tableView.sectionHeaderHeight = myData.count;
tableView.scrollEnabled = YES;
tableView.showsVerticalScrollIndicator = YES;
tableView.showsHorizontalScrollIndicator=YES;
tableView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
tableView.userInteractionEnabled = YES;
tableView.bounces = YES;
tableView.delegate = self;
tableView.dataSource = self;
[self.view addSubview:tableView];
what are wrong? why don't go the horizontal scroll?
Upvotes: 2
Views: 9942
Reputation: 1
Follow these steps to make a scrollable horizontal table view :
Hope that helps!!!!
Upvotes: -1
Reputation: 4331
What you are looking for is a UICollectionView
, not a UITableView
. Here you can implement cells and scroll in either direction.
In Interface Builder when you select the CollectionView it has a property called 'Scroll Direction' - change that to 'horizontal'
Upvotes: 5
Reputation: 9356
Please take a look at this. This should solve your problem.
https://github.com/alekseyn/EasyTableView
I did this when I was Stuck:
CGRect frame = tblView.frame;
tblView.transform = CGAffineTransformRotate(stressTblView.transform, M_PI / 2);
tblView.frame = frame;
Upvotes: 1