这不是一个 uiview 方向问题,我想让 iPhone 处于纵向或横向,并且我想要一个标准的 tableview( Controller ?),它将在 iphone 的垂直 strip 中显示单元格,并且 tableview 水平滚动。
-IE。一个 100% 的普通 tableview,即在不旋转手机方向的情况下旋转 90 度

这可能吗?

最佳答案

在 View Controller 中旋转viewDidLoad中的tableView:

-(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°
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
        CGAffineTransform transform = CGAffineTransformMakeRotation(1.5707963);
        cell.transform = transform;
}

关于iPhone Tableview在水平滚动而不是垂直滚动中使用单元格,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/2778521/

10-12 14:49
查看更多