views:

214

answers:

2

In the Preferences app, Safari's settings page contains buttons labeled "Clear History" or "Clear Cache". The Mail App's settings page contains a big red "Delete Account" button.

Is there a way to create such a settings page with buttons for my app? I checked Apple's documentation and didn't find an element type for such buttons.

A: 

AppStore apps — You can't. Even if you can add a button, no code can be run, making this useless.


Jailbroken apps — Use a PreferenceBundle and create a PSButtonCell specifier. See http://www.iphonedevwiki.net/index.php?title=Preferences_specifier_plist.

KennyTM
+1  A: 

Sadly I think you're out of luck - unless you jailbreak. To create the Settings page for your app you create a plist rather than actually coding the view itself. This brings certain restrictions such as the inability to add a button. The one core thing you can't do is to execute any code from the Settings app - all you can do is change a set of preferences.

The closest you can get is to add a switch with the label "Clear History on next starup" and check whether the user has set this whenever you start the app. Then set the settings so that the switch is set to Off.

pheelicks