问题
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?
Edit: Here is what I'm doing in the storyboard. It shows up fine in the simulator because, the table is empty then.
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:
回答1:
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
来源:https://stackoverflow.com/questions/38852441/issues-with-container-view