简体   繁体   English

在iOS 8中将集合或表格视图或自定义视图添加到滚动视图

[英]Adding a collection or tableview or custom view to a scrollview in ios 8

I have a UIScrollView with lots of sub views on the scrollview. 我有一个UIScrollView,scrollview上有很多子视图。 I have a picture, buttons, textfields and the like that all work fine. 我有一张图片,按钮,文本框之类的东西,一切正常。

Now I want to add a comment section below all this that "acts" like a UITableView. 现在,我想在所有像UITableView这样的“行为”下面添加一个注释部分。

What is the best way to accomplish this? 做到这一点的最佳方法是什么? I want the comment section to load 10 comments when that part of the view appears, and continually add 10 more comments when the 6th comment appears. 我希望评论部分在视图的该部分出现时加载10条评论,并在第六条评论出现时继续添加10条评论。 There should also be an activity indicator too. 也应该有一个活动指示器。

I know you can't put a collection view or tableview with a scrollview (according to Apple) as their are inherited from UIScrollView. 我知道您不能将带有collectionview的集合视图或tableview(根据Apple)放置,因为它们是从UIScrollView继承的。 And making the whole view controller a table view or collection view is tough since I have so many subviews and actions all linked up already. 将整个视图控制器设为表视图或集合视图非常困难,因为我已经链接了这么多子视图和动作。

What's the best approach? 最好的方法是什么?

Thanks. 谢谢。

您可以创建一个新的表视图控制器,并将当前控制器加载(在单元格内容视图上添加子视图)作为表视图控制器的第一个单元格。

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

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