简体   繁体   中英

Swift UITableView (with out scrolling) in UIScrollView

I am developing an app for website. I want to show post data. Each post has text and images. I wan to make one big scroll view to show this post content. I create UIViewController, where I insert UIScrollView.

In the UIScrollView I insert UILayer (which I make resizable) and UITableView (to show images). I want to make UITableView not scrollable but resizable. Can you help me?

Lol, ok I see where you're going with this. So what you will need to do is have an outer tableview. This is going to be the one that scrolls and contains the data of multiple posts. Then you only need one prototype cell. That prototype cell should have a UITextView and another tableview underneath for the images associate with that post. This tableview in the cell should not scroll, but should be resizable; I understand. In interface builder you can deselect the scrollable checkboxes, and use constraints to make it resizable.

Now here's the trick, the datasource for your images tableview needs to be the cell that contains it. The datasource for your outertableview will be its controller.

Does that make sense?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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