容器视图的问题 [英] Issues with container view
问题描述
我创建了一个页面,其中有两个容器视图,它们根据顶部的分段控件进行切换.基本上,我根据分段控件中选择的索引隐藏容器视图之一.现在在其中一个容器视图中,我添加了一个表格视图和一个单元格.我还为包含在其中一个符合 UITableView 数据源和委托协议的容器视图中的视图创建了一个 viewController 类.
I had created a page which has two container views that switch according to a segmented control on top. Basically I hide one of the container views based on what index is selected in the segmented control. Now within one of the container views, I added a table view and a cell. I also created a viewController class for the view contained in one of the containerviews which conforms to the UITableView DataSource and Delegate Protocols.
然而,当我运行应用程序时,分段视图不可见,我只能看到空单元格.我很困惑为什么分段控件甚至不显示.在容器视图中添加表视图后,是否有人遇到过这个问题?我可能做错了什么?
When i run the app however, the segmented view is not visible and all i can see are empty cells. I am stumped on why the segmented control isn't even displaying. Has anybody ever faced this issue after adding a table view within a container view? What could I be doing wrong?
这是我在故事板中所做的.它在模拟器中显示得很好,因为那时表是空的.
Here is what I'm doing in the storyboard. It shows up fine in the simulator because, the table is empty then.
当我在手机上运行它时,基本上,我用我从附近的地方 google web api 创建的数据库填充表.在设备上,当我导航到此页面时,没有显示段控件,我只能看到包含我正在获取的数据的表格.表格视图基本上占据了整个页面.我正在使用自动调整大小(没有自动布局).我检查了我提供的约束,一切似乎都很好.
When i run it on the phone, basically, I'm populating the table with a database I create from the nearby places google web api. On the device, it when i navigate to this page, the segment control is not shown and all I can see is the table with the data I'm fetching. The table view basically takes up the whole page. I'm using autoresizing(no autolayout). I checked the constraints I'm providing and everything seems to be fine.
这是我在设备上运行同一页面时得到的结果:
This is what I get when I run the same page on the device:
推荐答案
我看到了.我犯了一个愚蠢的错误!段控件未显示的原因是因为它位于页面布局中的容器视图下方!我只是把它拉到前面,它出现在设备和模拟器上.干杯
I got it showing. Stupid mistake on my part! The reason why the segmentcontrol wasn't showing was because it was below the container views in the page layout! I just pulled it to the front and it shows up on the device and the simulator. Cheers
这篇关于容器视图的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!