gpt4 book ai didi

objective-c - 如何在 iPhone 上制作水平 UI 表格 View ?

转载 作者:太空狗 更新时间:2023-10-30 03:13:27 26 4
gpt4 key购买 nike

通常,UITableView 是这样的:

[   cell    1   ]
[ cell 2 ]
[ cell 3 ]
[ cell 4 ]

但我想像这样制作我自己的 UITableView:

   |    |   |   |
| c | c | c |
| e | e | e |
| l | l | l |
| l | l | l |
| | | |
| 1 | 2 | 3 |
| | | |

我希望用户向左和向右滑动以获得与原始 UITableView 类似的行为.... ...我该怎么做?谢谢。

最佳答案

使用带有 UIView 的 UIViewController,将表的 UITableView 添加到 Controller View ,然后就代码而言,只需一行:

- (void)viewDidLoad
{

[super viewDidLoad];

// horizontal table
// -90 degrees rotation will move top of your tableview to the left
myTableView.transform = CGAffineTransformMakeRotation(-M_PI_2);
//Just so your table is not at a random place in your view
myTableView.frame = CGRectMake(0,0, myTableView.frame.size.width, myTableView.frame.size.height);
...

关于objective-c - 如何在 iPhone 上制作水平 UI 表格 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2834840/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com