ios - 为什么UIViewController子类的xib中是UIView而不是UIViewController?

标签 ios objective-c uiviewcontroller xib

当我新创建 UIViewController 的 subview 以及 xib 文件时,我发现它是一个 UIView 但不是 UIViewController xib 文件中。
那么为什么 Xcode 会这样实现 xib 文件呢?什么目的?

新创建的类:-

enter image description here

xib 文件:-

enter image description here

最佳答案

它是UIViewController的类型,只需选择File'S Owner,然后检查身份检查器,您会看到它已经设置了类NewViewController 就像这张图片。

enter image description here

在检查连接检查器之后,还要检查选择您的 View ,您会看到它与文件所有者 View 连接,如下图所示。

enter image description here

关于ios - 为什么UIViewController子类的xib中是UIView而不是UIViewController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39031931/

相关文章:

objective-c - 用于 Web 查询的多个同时 NSConnections

swift - 无法关闭 View Controller

IOS - 如何以编程方式阻止从另一个应用程序打开一个应用程序?

ios - 在 Swift 中使用 UIIamgePickerControllerDelegate 在屏幕上显示选定的图像

iphone - 在 iOS 5 应用程序中将文件保存在何处?

ios - 在另一个 UIViewController 中处理 UITapGestureRecognizer

ios - 当用户点击 View Controller 时如何使 SWRevealViewController 菜单消失

iphone - 如果@2x 图像可用但常规分辨率图像不可用,会发生什么情况?

ios - 将外部 UI 组件添加到 Storyboard

c++ - 从 C++ 调用 NSLog : "Format string is not a string literal (potentially insecure)"