Display data in two different TableView in the same View in Swift

半世苍凉 提交于 2019-12-20 06:32:50

问题


I'm creating an app for iPad, and because of their size decided to do something a little different. I'm creating something like this:

I am using two UITableView in a UIView. I need to display data 'product categories' in the first TableView and 'products' in the second TableView.

The problem is display data in two tables with direferentes contents. Another detail: When a category is selected, the table 'product' is recharged with other data of other products.

My question is: How can I display data in two different TableView in the same View?


回答1:


Just add two Containers to your View Controller and drag from the container view to your desired Table View Controller and click embed. Then you'll need to make two separate UITableViewController Cocoa files and assign them to the table view in your Identity Inspector.

In this picture I've already attached the container on the left to my Table View Controller on the left.



来源:https://stackoverflow.com/questions/34213813/display-data-in-two-different-tableview-in-the-same-view-in-swift

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