简体   繁体   English

macOS - 使用比部署目标更新的 UI 元素编译 xib

[英]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 文件时。

You can select the GridView in your.xib and in File Inspector you can choice the appropriate version this grid view should be built under "Builds for" dropdown.您可以 select GridView 在 your.xib 和文件检查器中选择适当的版本,此网格视图应在“构建”下拉列表下构建。 Works for me, no compilation error.对我有用,没有编译错误。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 macOS Simulator 部署目标设置为 13.5,但此平台支持的部署目标版本范围为 13.1 到 13.4.999 - macOS Simulator deployment target set to 13.5, but the range of supported deployment target version for this platform is from 13.1 to 13.4.999 如何从 Xcode 中的 MacOS 应用程序中删除部署目标错误? - How to remove deployment target errors from MacOS app in Xcode? 如何在 Swift 中为 MacOS 上的 VoiceOver 分组 UI 元素? - How to Group UI Elements in Swift for VoiceOver on MacOS? Xcode 7:编写具有iOS 9以下部署目标的UI测试? - Xcode 7 : Write UI Tests with a deployment target below iOS 9? iOS-将框架链接到比我项目的部署目标更高的部署目标 - iOS - Link a framework with higher deployment target than my project's 由于部署目标早于设备,着色器性能数据可能不可用 - Shader performance data maybe unavailable due to deployment target older than device 在iOS中选择部署目标 - Selecting Deployment target in iOS xcode 错误部署目标 - xcode bug deployment target 框架的无效部署目标 - Invalid deployment target of the framework 我们可以将swift代码集成到部署目标低于iOS 7的应用程序中吗? - Can we integrate the code of swift in applications having deployment target less than iOS 7?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM