Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone Tableview Use Cells in Horizontal Scrolling not Vertical

This is not an uiview orientation question, I want to Have the iphone in Portrait or Landscape, and I want a standard tableview(controller?) that will display cells in a vertical strip down the iphone and the tableview scrolls horizontally. -I.e. a 100% normal tableview, that is rotated 90deg without rotating the phone orientation

Is this possible?

like image 277
oberbaum Avatar asked May 06 '10 04:05

oberbaum


People also ask

How do I turn on horizontal scrolling?

Horizontal scrolling can be achieved by clicking and dragging a horizontal scroll bar, swiping sideways on a desktop trackpad or trackpad mouse, pressing left and right arrow keys, or swiping sideways with one's finger on a touchscreen.

How do I insert a scroll horizontal?

Click File > Options. On the Advanced tab, scroll to the Display section. Select Show horizontal scroll bar and Show vertical scroll bar, and then click OK.

Is horizontal or vertical scrolling better?

The Appeal of Horizontal Scrolling The dominant standard for moving through long pages of content on desktop sites is by scrolling vertically. The conventional mouse and the scroll wheel make it easy for people to scroll up and down, thus reinforcing the pattern.

How do I scroll to top tableView?

To scroll to the top of our tableview we need to create a new IndexPath . This index path has two arguments, row and section . All we want to do is scroll to the top of the table view, therefore we pass 0 for the row argument and 0 for the section argument. UITableView has the scrollToRow method built in.


1 Answers

in the view controller rotate the tableView in viewDidLoad:

-(void)viewDidLoad {   
 self.table.rowHeight = 320.0;   
 self.table.separatorStyle = UITableViewCellSeparatorStyleSingleLine;   
 // Rotates the view.   
 CGAffineTransform transform = CGAffineTransformMakeRotation(-1.5707963);    
 self.table.transform = transform;  
 // Repositions and resizes the view.   
 CGRect contentRect = CGRectMake(0, 90, 320, 300);  
 self.table.frame = contentRect;    
 self.table.pagingEnabled
        = YES;   
 [super viewDidLoad]; 
}

but you will have cell rotated 90°!!! I solved rotating cellView -90°

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath 
{
        CGAffineTransform transform = CGAffineTransformMakeRotation(1.5707963);
        cell.transform = transform;
}
like image 153
nikoz Avatar answered Oct 18 '22 00:10

nikoz