can anyone tell me how to use switch? [duplicate]
Possible Duplicate:
How to apply setting by toggle switch?
I want to use switch but开发者_如何学运维ton to toggle on and off of a setting
can anyone tell me how to set it up? I already have the following code
Thanks!
declaration
- (IBAction) changeMode:(id)sender;
implementation
-(IBAction) changeMode:(id)sender
{
}
After you hook up the UISwitch in Interface Builder, you can check if it's on like this:
-(IBAction) changeMode:(id)sender
{
if ([(UISwitch *)sender on])
{
NSLog(@"The switch is on.");
}
else
{
NSLog(@"The switch is off.");
}
}
精彩评论