UITableView portion loses interaction after device rotation

旧时模样 提交于 2019-12-23 16:16:34

问题


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)

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.

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


回答1:


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

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

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



来源:https://stackoverflow.com/questions/7792641/uitableview-portion-loses-interaction-after-device-rotation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!