ios - 找不到容器 View 对象

标签 ios objective-c xcode7 uicontainerview

我是唯一一个在 Xcode 7 中找不到 Container View 对象的人吗??

我以前用过这个功能,现在我想重新实现它,但我找不到它。

我想知道 maybe now 是否已被弃用,但它仍在 Apple 官方文档中。

https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/ImplementingaContainerViewController.html

enter image description here

我想做的是重现 Snapchat 导航 View ,我有一个带有分页的 scrollView,每个页面上将包含 3 个 View Controller 。我想使用容器来添加每个 subview Controller 。

最佳答案

为了回应用户 Raj Tandel 在评论中发布的答案,显然您不能将容器 View 与 xibs 一起使用。

Here is a great thread这解释了原因:

It is not possible as it needs to deal with parent and child view relationship which is not meant for xib(s)

解决方案是“只需将一个普通的 UIView 添加到 xib 以充当容器。然后在代码中,将您的 subview Controller 的 View 添加为容器的 subview ”

有关更多信息,请单击上面包含的链接(努力保持良好的答案和主题的连续性,而不是重复已经存在的内容)

关于ios - 找不到容器 View 对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36306688/

相关文章:

Objective-C If Or 语句

ios - 为什么状态栏字体大小在 iphone 6 上发生变化?

ios - 分组 UITableView - 允许多选和单选

iphone - 如何打开下一个 View 点击 UIImageview?

objective-c - 使用 NSScanner 从最后一个字符实例扫描到字符串结尾

objective-c - 如何从另一个 View Controller 呈现一个 View Controller

ios - 在 iOS 应用程序中导入 MP3(使用代码)

ios - XCTestCase:WAITING应用空闲

c++ - 在 Xcode 控制台项目中创建和使用 C++ 库

ios - 将 iOS10 模拟器与 XCode 7.2 结合使用