iOS Tutorial Adding your settings to the default Settings app

By following the steps in this tutorial you can allow users to configure the various app settings in the default Settings app.

SS-2014-12-30_12.28.50.png


The settings are defined in one or more plist files (xml files). The files should be located under Files\Special\Settings.bundle.

The main settings file name is Root.plist:

SS-2014-12-30_12.34.01.png


You can use the SettingsCreator desktop application (written with B4J) to create these files:

SS-2014-12-30_12.35.41.png


The plist format is documented here: https://developer.apple.com/library...ction.html#//apple_ref/doc/uid/TP40007005-SW1

The SettingsCreator application is quite simple. Right click on the list to add new items.

B4i code

The Settings object from iPhone library (v1.20+) allows you to get or set the settings.
Each setting is made of a key and value. Similar to Maps.
You need to declare and initialize a Settings object and then you can get or put values:
B4X:
Dim set As Settings
set.Initialize
Dim Toggle1 As Boolean = set.GetBoolean("ts1")
set.Put("sr1", 50)
Note that you can also create new keys (which will not be visible in the settings app).

The modified settings are saved automatically from time to time. You can call Settings.Synchronize to force the changes to be saved immediately.

The compiled settings creator utility is attached. The source code is available here: https://www.b4x.com/android/forum/threads/ios-settingscreator.48779/
 

Attachments

  • SettingsCreator.jar
    246.5 KB · Views: 683
  • SettingsExample.zip
    2 KB · Views: 717
Last edited:

Taha

Member
Licensed User
Longtime User
My settings appear in the default settings app only after device reboot. Is there a workaround?
 
Top