Working With Application Settings

Dheeraj Kumar Gunti

Reading Time : ( words)


For every application there will be settings option which will be located at Settings > General > Application Name

Here is the small example where we will see how to create a Settings section.

Open Xamarin Studio. Click on Empty Solution and create a new Solution.



Once the application skeleton is created. Right click and add new file.



Choose iOS section and select "Setting Bundle". The default name will be Root.plist.



Once the file is added to the solution it will be looked as below.



Root.plist is like a normal property list as Info.plist. But here we will be specifying only items which should show on Settings section.



In this example we have created three property entries "UserName", "Password", "Gender".

To Add more properties click on Add new Entry and choose the type of entry.

Once the property listing is done. Here is the code snippet to access the Settings.

var username = NSUserDefaults.StandardUserDefaults.StringForKey ("Username");
var password = NSUserDefaults.StandardUserDefaults.StringForKey ("Password");
var gender = NSUserDefaults.StandardUserDefaults.StringForKey ("Gender");



Enjoy Coding.... :)