横向滚动的UITableView

横向滚动的UITableView

1.实现思路

旋转tableview,90度,cell也旋转90度,

上代码:

 1     _tableView.transform =CGAffineTransformMakeRotation(-M_PI /2);
 2 
 3 //delegate
 4 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 5 {
 6     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"identifier"];
 7     if (cell == nil) {
 8         cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"identifier"];
 9         cell.backgroundColor =[UIColor groupTableViewBackgroundColor];
10         cell.textLabel.text=@"都好好的";
11         // cell顺时针旋转90度
12         cell.contentView.transform = CGAffineTransformMakeRotation(M_PI / 2);
13     }
14     
15     return cell;
16 }
IOS开发
原文地址:https://www.cnblogs.com/luanmage/p/5075214.html