如何在iPhone上制作水平UI表格视图?

Tat*_*tat 20 iphone objective-c uitableview

通常,UITableView是这样的:

[   cell    1   ]
[   cell    2   ]
[   cell    3   ]
[   cell    4   ]
Run Code Online (Sandbox Code Playgroud)

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

   |    |   |   |
   | c  | c | c |
   | e  | e | e |
   | l  | l | l |
   | l  | l | l |
   |    |   |   |
   | 1  | 2 | 3 |
   |    |   |   |
Run Code Online (Sandbox Code Playgroud)

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

gab*_*ino 22

使用带有UIView的UIViewController,将表的UITableView添加到控制器视图,然后在代码方面只有一行:

- (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);
...
Run Code Online (Sandbox Code Playgroud)


Tom*_*ing 13

这里有一个项目可能也有用,http://github.com/TheVole/Horizo​​ntalTable

  • 这看起来像一个很好的项目,不幸的是它是在GNU GPL下获得许可的,这使得在App Store应用程序中使用很难,甚至不可能. (3认同)
  • 不再是GPL下的,现在是麻省理工学院! (2认同)