简体   繁体   English

创建宽度大于其表的UITableViewCell

[英]Create UITableViewCell with greater width than its table

I have a custom UITableViewCell that its width is larger than UITableView's one (>1500px), user can scroll horizontally to show the whole cell. 我有一个自定义的UITableViewCell,它的宽度大于UITableView的宽度(> 1500px),用户可以水平滚动以显示整个单元格。

I tried to set the contentSize.width of the table to match my cell's width but when I scroll the table view to the left, and when I reach a point higher than screen width, all information disappear and table become white. 我试图将表格的contentSize.width设置为与单元格的宽度相匹配,但是当我向左滚动表格视图时,并且当我到达高于屏幕宽度的位置时,所有信息消失并且表格变成白色。

您只需要在每个UITableViewCell内部使用一个UIScrollView。

我最终将表格视图放到UIScrollView中,并将其宽度设置为与最大UITableViewCell宽度匹配,然后将UIScrollView的内容宽度设置为与该宽度匹配,现在我可以水平滚动表格了,谢谢。

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

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