Using A Switch

Declare in the .h

	IBOutlet UISwitch *MySwitch;
In #ViewController.m

//If view could be unloaded
//********** VIEW DID UNLOAD **********
- (void)viewDidUnload
{
	[super viewDidUnload];

	[MySwitch release];
	MySwitch = nil;
}

//********** DEALLOC **********
- (void)dealloc
{
	[MySwitch release];

	[super dealloc];
}

Setting Switch Properties


	[MySwitch setOn:YES animated:YES];
	
	if (MySwitch.on)
		NSLog(@"switch state: on");

	MySwitch.enabled = YES;

Getting Switch State


	if (MySwitch.on)

Calling A Method On Switch Changed Event

Use the switches Value Changed event


- (IBAction) MySwitchValueChanged:(id) sender
{  
	if (MySwitch.on)
		[MyLabel setText:@"ON"];
	else
		[MyLabel setText:@"OFF"];
}