UISwitch

A UISwitch represents a graphical on/off switch that you can tap .

Example
UISwitch switch =
   [ [UISwitch alloc]
   initWithFrame:CGRectMake(0,170,320,50)];

[switch addTarget: self
    action: @selector(flipSwitch:)
    forControlEvents: UIControlEventValueChanged];

[self.view addSubview: switch];




// use switch.on to see if the switch is on or off


-(void) flipSwitch: (id) sender
{
     // do whatever
}