NSPreferencePane - Change Title of the Window

388 views Asked by At

I am currently working with an NSPreferencePane and am having trouble setting the title of the Window once the PreferencePane nib file has been set. Any help with this would be greatly appreciated ?

I have tried accessing the window from the mainView, however, this is null. I have also attempted to set an IBOutlet connecting to the NSWindow from inside its nib file. From reading through the NSPreferencePane documentation the property _window is set to be private and I am unsure how I can access this so as I can change its value.

Thanks, Michael

2

There are 2 answers

0
George On BEST ANSWER

The preference pane's title comes from the bundle name. Change this in the preference pane's Info.plist to whatever you want the title to be. It will probably be set to ${PRODUCT_NAME} by default.

Make sure you do a clean before building and trying this, otherwise the old name will stick around.

0
user3440665 On

You can control the name of the prefPane bundle separate from the name that shows in the System Preferences and the title-bar of the prefPane window. E.G., to get ...

bundle "file" name: EG.prefPane

name shown in System Preferences
this preferences window title: Example Preferences

... use the following entries in the product's Info.plist file (i.e., in 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>