简体   繁体   English

UITableView没有出现在UIScrollView中

[英]UITableView doesn't show up in UIScrollView

I've created a view with a UIScrollView , it has height 1000px. 我用UIScrollView创建了一个视图,它的高度为1000px。 I've added a UITableView to the view, plus other labels and buttons. 我已经向视图添加了UITableView以及其他标签和按钮。 When I launch it, everything is in its place except the table. 当我启动它时,除了桌子以外的所有东西都在它的位置。 Can anyone fix my problem? 谁能解决我的问题?

I've tried: 我试过了:

table.hidden = NO;

and

[scrollView addSubview:table];

but nothing happened. 但是什么也没发生。

The documentation for UIScrollView specifically says not to do this: UIScrollView的文档专门说不要这样做:

Important : You should not embed UIWebView or UITableView objects in UIScrollView objects. 重要说明 :不应将UIWebViewUITableView对象嵌入UIScrollView对象中。 If you do so, unexpected behavior can result because touch events for the two objects can be mixed up and wrongly handled. 如果这样做,可能会导致意外行为,因为两个对象的触摸事件可能会混合在一起并且处理不当。

I would suggest adding the other views you intend to put into the scroll view into the table as a tableHeaderView , tableFooterView , or as custom cells. 我建议将要放入滚动视图中的其他视图作为tableHeaderViewtableFooterView或作为自定义单元格添加到表中。

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

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