iPhone Tableview在水平滚动中使用单元格不垂直 [英] iPhone Tableview Use Cells in Horizontal Scrolling not Vertical

查看:94
本文介绍了iPhone Tableview在水平滚动中使用单元格不垂直的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这不是一个uiview方向问题,我想要在纵向或横向中使用iphone,我想要一个标准的桌面视图(控制器?),它将在iphone的垂直条带中显示单元格,并且tableview水平滚动。
-I.e.一个100%普通的桌面视图,旋转90度而不旋转手机方向

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

这可能吗?

推荐答案

在viewDidLoad中旋转tableView:

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]; 
}

但你将细胞旋转90°!我解决了旋转cellView -90°

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;
}

这篇关于iPhone Tableview在水平滚动中使用单元格不垂直的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆