Jump to content

[help]how can i add PSLink into my preferencesbundle with PSSwitch


Go to solution Solved by castix,

18 posts in this topic

Recommended Posts

  • Solution
Posted (edited)

Open your Preferences.mm (or whatever you called it) and paste this new code inside before the // vim:ft=objc

where CUSTOMNAME is the name of the new property list you want to add for your PSLink.

@interface CUSTOMNAMEListController: PSListController {
}
@end

@implementation CUSTOMNAMEListController
- (id)specifiers {
    if(_specifiers == nil) {
        _specifiers = [[self loadSpecifiersFromPlistName:@"CUSTOMNAME" target:self] retain];
    }
    return _specifiers;
}
@end

Now open your main property list. As you already know some XML basics from other preference specifiers, this is the new PSLinkCell which appears in your preference pane. You don't add the swiches you want inside the new PSLink inside this property list. You'll see it later.

<dict>
    <key>cell</key>
        <string>PSLinkCell</string>
    <key>detail</key>
        <string>CUSTOMNAMEListController</string>
    <key>isController</key>
        <string>1</string>
    <key>label</key>
        <string>CUSTOMNAME</string>
</dict>

Finally create a new property list (plist) with your custom name you've chosen previously. In the new plist you can add all items for the PSLinkCell. All your switches, sliders, buttons, segments etc.

The new property list is also going to be in your Resources folder unlike the Preferences.mm.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>items</key>
    <array>
        <dict>
    <key>cell</key>
        <string>PSSwitchCell</string>
    <key>default</key>
        <false/>
    <key>defaults</key>
        <string>Preferences</string>
    <key>key</key>
        <string>Key</string>
    <key>label</key>
        <string>Example for a PSSwitchCell</string>
</dict>
    </array>
    <key>title</key>
    <string>CUSTOMNAME</string>
</dict>
</plist>
Updated by castix

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines