开发者

Horizontal Scrolling UITableView - Caveats?

开发者 https://www.devze.com 2023-01-19 19:15 出处:网络
Would it be as simple as applying a rota开发者_StackOverflow中文版tion transform? I\'m willing to manage the content of my cells with a rotation transform.Yes, it is as simple as appyling a Transform.

Would it be as simple as applying a rota开发者_StackOverflow中文版tion transform? I'm willing to manage the content of my cells with a rotation transform.


Yes, it is as simple as appyling a Transform.

Here is the code. Write this in the your tableViewController init:

self.view.frame = CGRectMake(100,-5,250,350); //any Frame of your choice
CGAffineTransform trans = self.view.transform; // get current transform (i.e. portrait)
trans = CGAffineTransformRotate(trans, (M_PI / -2.0)); // rotate 90 degrees to go landscape
self.view.transform = trans; // set current transform (landscape)

But now what you need to realize is that your axis are also swapped. Any changes you make to the height will change the width (and vice versa) and any changes made to the origin.x changes the origin.y (and vice versa)


It's possible, just need to get the rotation right on all the components in your tableview. I don't have some sample code right now though, but we have it working in our app at work.


I have published sample code that demonstrates one approach for implementing horizontally scrolling UITableViews using transforms. It's called EasyTableView and provides the same interface for both vertically and horizontally scrolling table views.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号