简体   繁体   English

UITableView旋转后的垂直反弹(contentView?)

[英]Vertical bounce after UITableView rotation (contentView ?)

I rotate my tableView by using tableView.transformation to use a portrait tableView in landscape mode, but since I've been doing this, my TableView bounces vertically and horizontally. 我使用tableView.transformation来旋转我的tableView以在横向模式下使用肖像tableView,但是因为我一直这样做,所以我的TableView垂直和水平地反弹。 By default, a tableView only bounces vertically; 默认情况下,tableView仅垂直弹跳; so I thought that after rotating it, I would get only a horizontal bounce, but its bounces both horizontally and vertically. 所以我想在旋转之后,我只能获得水平弹跳,但它会在水平和垂直方向上反弹。

Does anyone know how to fix this? 有谁知道如何解决这一问题? Maybe it has something to do with the contentView of the tableView (UITableView inherits from UIScrollView). 也许它与tableView的contentView有关(UITableView继承自UIScrollView)。 I've tried to set the contentView but it doesn't work. 我试图设置contentView但它不起作用。

The simplest implementation 最简单的实现

UITableView *tv = [[UITableView alloc] initWithFrame:CGRectMake(10.f, 10.f, 300.f, 300.f) style:UITableViewStylePlain];
tv.transform = CGAffineTransformMakeRotation(1.5707);
[self.view addSubview:tv];

works as expected. 按预期工作。 The table only bounces vertically (which is horizontal on the screen). 该表仅垂直弹跳(在屏幕上是水平的)。 If you're creating the table in IB, make sure Bounces and Bounce Vertically are selected, but Bounce Horizontally is not. 如果您在IB中创建表格,请确保选中“垂直弹跳和弹跳”,但不选择“水平弹跳”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM