在Swift的同一视图中的两个不同的TableView中显示数据 [英] Display data in two different TableView in the same View in Swift

查看:228
本文介绍了在Swift的同一视图中的两个不同的TableView中显示数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为iPad创建一个应用程序,由于尺寸原因,我决定做一些不同的事情.我正在创建类似这样的东西:

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:

我正在UIView中使用两个UITableView.我需要在第一个TableView中显示数据产品类别",并在第二个TableView中显示数据产品".

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.

我的问题是:如何在同一视图中的两个不同的TableView中显示数据?

推荐答案

只需在您的View Controller中添加两个容器,然后将其从容器视图拖动到所需的Table View Controller,然后单击嵌入.然后,您需要制作两个单独的UITableViewController Cocoa文件,并将它们分配给Identity Inspector中的表视图.

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.

在这张照片中,我已经将左侧的容器连接到左侧的Table View Controller.

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

这篇关于在Swift的同一视图中的两个不同的TableView中显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆