如何将 Interface Builder 中的视图连接到 Xcode 11 中另一个框架的超类中定义的 IBOutlet

How do I hook up a view in Interface Builder to an IBOutlet defined in a superclass from another framework in Xcode 11

在 Xcode 11 之前,如果我有检查器 window 打开并单击命令进入我的视图(在这种情况下,UITableViewCell subclass 的 subclass 将在检查器 [=43] 中打开 superclass =] 我可以附加到 IBOutlet。在 Xcode 11 中,但似乎当命令单击 "definition" 时,它会在 LHS 面板中打开,它会替换我的故事板或 xib 文件观点超级class.

有什么办法可以在 Xcode 11 中打开 xib/storyboard 旁边的 superclass 吗?我的框架是一个预编译的框架,所以我无法访问源文件以在 Xcode.

的新面板中打开它们

认为包含 class 层次结构

可能是明智的

LargeHeaderTableViewCell -> TableViewCell -> UITableViewCell

TableViewCell 在预编译框架内(使用 Carthage 安装)

编辑:

更糟的是...我可以在我的 xib 文件旁边打开 TableViewCell 的 class 定义(在面板中),但是您似乎只能在 assistant 编辑器中附加到 IBOutlets,而不是在标准的 Xcode panel/tab/whatever 中。

(最终)在 here

中找到了答案

I realize that this question was posted a while ago, but since I just struggled with the same issue and finally came up with a solution, I figured I would still post my findings...

I understand the problem to be as follows (at least that's the one I solved):

How to have class A inherit from class B, with each class having its own XIB file with the some common IBOutlet properties? The goal being to be able to have the super class handle the actions related to the IBOutlets that are common to its subclass(es), while still being able to use Interface Builder to design the interface for the subclass(es).*

In order to do so:

Make the IBOutlet connections in the superclass from the superclass' XIB files Make the IBOutlet connections in the subclass from the subclass' XIB files, with the same IBOutlet property names as in the superclass for the ones you need to inherit. Delete the declaration of the IBOutlet variables in the subclass