Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个自定义myCustomNSView课程。我还为它创建了一个 nib 文件。如何将两者链接在一起,以便我可以实例化 myCustomNSView 类并将其添加为其他视图的子视图?这个问题提供的答案是完美的,除了我使用的是 OSX 而不是 iOS。
myCustomNSView
查看Apple 的文档,我看到以下内容:
OSX 如何做到这一点?
如果你查看 header NSNib.h,你会看到新的官方方法是:
NSNib.h
- (BOOL)instantiateWithOwner:(id)owner topLevelObjects:(NSArray **)topLevelObjects
它与 UIKit 非常相似。我不知道,为什么它的记录如此糟糕。