Possible Duplicate:
Change Label of UISWitch
How to create uiswitch with yes/no in ios6 xcode 4.5.Tried customizing a switch but did not achieve the result. Any help would be greatly appreciated.Thanks in advance.
Possible Duplicate:
Change Label of UISWitch
How to create uiswitch with yes/no in ios6 xcode 4.5.Tried customizing a switch but did not achieve the result. Any help would be greatly appreciated.Thanks in advance.
Make a UISwitch Control. Then add an action which listens to the ValueChanged of the control. Remember to add the UISwitch to your view at the correct placement, here i am just making 40 x 40 switch.
UISwitch *switchControl = [[UISwitch alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
[switchControl addTarget:self action:@selector(switchTapped:) forControlEvents:UIControlEventValueChanged];
In the switchTappedMethod, you find the state with this value:
-(void) switchTapped: (id) sender {
UISwitch *switchControl = (UISwitch*) sender;
BOOL value = switchControl.isOn;
}