融孚律师事务所官网:实现横向的tableView

来源:百度文库 编辑:九乡新闻网 时间:2024/04/25 16:27:05
n 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];
}
ut 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;
}