Question

Recently I've been developing a tweak for Cydia using an excellent framework (Theos by the awesome Dustin Howett) and I'd like to know whether there is any way to grey out a cell in the preference bundle of the tweak. It doesn't matter whether it will require a private API as this is for a jailbroken environment. Any help, links or references are greatly appreciated. I'm using a private framework (Preferences.framework).

Was it helpful?

Solution

I don't have my jailbroken phone with me, so I can't test this, but if you look at the Preferences docs on iphonedevwiki, you'll see that there is a flag that will gray out preference items (enabled). So, you might use a chunk of code in your preferences plist file like this:

     <dict>
        <key>cell</key>
        <string>PSSwitchCell</string>
        <key>default</key>
        <true/>
        <key>defaults</key>
        <string>com.mycompany.myapp</string>
        <key>key</key>
        <string>wifi_location</string>
        <key>label</key>
        <string>WiFi Location</string>
        <key>enabled</key>                 
        <false/>                           <!-- gray out this item -->
     </dict>

If you look at the preference loader docs, you see that you also can inject code into Preferences.app, which would probably allow you to set this flag dynamically (probably needed if you're tweaking an app that's not yours).

See more on this here

I'll try to test this later, and hopefully, update this answer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top