In his post I am going to tell you that how can we take advantage of UISwitch in our IPhone app.
Suppose we have a requirement where we want to show user a password screen before app opens up and this screen appearance is totally dependent on value set by user in settings screen of the app.In this case we can use UISwitch control and saving user preferences based on the UISwitch selection or value.Now lets jump int to the code
Open your .h file and create an IBOutlet for our UISwitch control and declare its IBAction.
@interface ADCViewController : UIViewController
IBOutlet UISwitch *passwordSwitch;
Now, open up your .xib file, drag and drop UISwitch Control to it. Connect your IBOutlet (right click on File Owner, select circle next to our outlet and drag it towards UISwitch control) and set is section for valueChanged event (this will trigger when value of our UISwitch gets changed).
Open your .m file as its time to write our method written in .h file
if ([passwordSwitch isOn])
//set it on
//set it to off
That’s it you are all done with UISwitch.