[英]macOS - Compile xib with UI elements newer than the deployment target
I want to use an NSGridView
in a.xib file for a custom view.我想在 a.xib 文件中使用NSGridView
来自定义视图。 NSGridView
's are only available on macOS 10.12 and later, but my app runs on macOS 10.11 and later. NSGridView
仅适用于 macOS 10.12 及更高版本,但我的应用程序可在 macOS 10.11 及更高版本上运行。
So when compiling my application I get an error at the stage, where the.xib files are compiled:因此,在编译我的应用程序时,我在编译 .xib 文件的阶段出现错误:
NSGridView before OS X 10.12
What I would want to do is create two separate.xib files, one which is compatible with macOS prior to 10.12 (this would contain an alternative to NSGridView
) and the other one for all above version (this would then use NSGridView
).我想要做的是创建两个单独的.xib 文件,一个与 10.12 之前的 macOS 兼容(这将包含NSGridView
的替代品),另一个用于所有上述版本(然后将使用NSGridView
)。 In the view controller I would load the correct.xib file based on the macOS version with if #available(OSX 10.12, *)
.在 controller 视图中,我将使用if #available(OSX 10.12, *)
根据 macOS 版本加载正确的 xib 文件。
The problem is that the project doesn't even compile, when it contains a.xib file with an NSGridView
.问题是该项目甚至没有编译,当它包含一个NSGridView
的.xib 文件时。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.