设备旋转后,UITableView部分失去了交互 [英] UITableView portion loses interaction after device rotation

查看:89
本文介绍了设备旋转后,UITableView部分失去了交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有UIView子类的UIViewController作为子视图,在这里有一个UITableView作为该UIView的子视图添加,如下所示:

I have a UIViewController with a UIView subclass as a subview, and in here is a UITableView added as a subview of that UIView, as follows:

UIViewController
-UIView
--UITableView (plucked from a UITableViewController)

在iPad上,如果我在任一方向上加载视图控制器,都可以与表格视图完美地交互.但是,如果我将设备旋转到新的方向-我有更改框架的代码以使其适应新分辨率的代码,但是桌子的一小块区域无法响应触摸和其他响应.

On an iPad, if I load the view controller in either orientation I can interact with the table view perfectly. However, if I rotate the device to a new orientation - I have code that alters the frames to make it fit the new resolution, but a small area of the table does not respond to touches and whatnot.

例如,我们将肖像旋转为横向:如果您想像将肖像形状放置在横向屏幕上-该区域仍保持响应状态,但是右侧的小条不响应.

eg, we rotate portrait to landscape: if you imagine a portrait shape placed over a landscape screen - this area remains responsive, but a small strip to the right hand side does not respond.

有人对我可能错过的事情有任何想法吗?预先感谢.

Does anyone have any ideas what I may have missed? Thanks in advance.

我已经成功验证了从表视图单元格到顶部UIViewController的所有对象的CGRect框架.

I have successfully verified the CGRect frames of all objects from the tableview cells through to the top UIViewController.

推荐答案

在旋转后失去交互作用的区域必须落在其超级视图的框架之外.

The area that looses its interaction must have fallen outside its superview's frame after rotation.

您可以通过设置tableView.clipSubviews = YES来检查;

you can check that by setting tableView.clipSubviews = YES;

使用此方法,将裁剪掉属于Superview之外的tableview部分.

using this, will crop the tableview portion falling outside the superview.

这篇关于设备旋转后,UITableView部分失去了交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆