【问题标题】:NSPreferencePane - Change Title of the WindowNSPreferencePane - 更改窗口的标题
【发布时间】:2013-10-30 14:11:49
【问题描述】:

我目前正在使用 NSPreferencePane,并且在设置 PreferencePane nib 文件后无法设置窗口的标题。对此有任何帮助将不胜感激?

我已尝试从 mainView 访问窗口,但是,这是 null。我还尝试设置一个 IBOutlet 从其 nib 文件内部连接到 NSWindow。通过阅读 NSPreferencePane 文档,属性 _window 设置为私有,我不确定如何访问它以便更改其值。

谢谢, 迈克尔

【问题讨论】:

    标签: macos nspreferencepane


    【解决方案1】:

    首选项窗格的标题来自包名称。在首选项窗格的 Info.plist 中将其更改为您想要的标题。默认情况下,它可能会设置为 ${PRODUCT_NAME}。

    确保在构建和尝试之前进行清理,否则旧名称会保留。

    【讨论】:

      【解决方案2】:

      您可以控制 prefPane 包的名称,与系统偏好设置中显示的名称和 prefPane 窗口的标题栏分开。例如,得到...

      bundle "file" name: EG.prefPane
      
      name shown in System Preferences
      this preferences window title: Example Preferences
      

      ...在产品的 Info.plist 文件(即在 Xcode 中)中使用以下条目:

      <key>CFBundleExecutable</key>
      <string>${EXECUTABLE_NAME}</string>
      <key>CFBundleIconFile</key>
      <string>EG</string>
      <key>NSPrefPaneIconLabel</key>
      <string>Example Preferences</string>
      <key>NSPrefPaneSearchParameters</key>
      <string>EG</string>
      <key>CFBundleName</key>
      <string>Example Preferences</string>
      <key>CFBundleGetInfoString</key>
      <string>Example Preferences 1.0</string>
      

      【讨论】:

        猜你喜欢
        • 2012-02-04
        • 1970-01-01
        • 1970-01-01
        • 2015-10-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多