I you want to change state of the UISwitch with animation (looks better :)) just check this snippet.
We will be using UISwitch, beginAnimations, setAnimationDuration and commitAnimations
- (IBAction) toggleSwitchWithAnimation: (BOOL) how {
// beginning the animation
[UIView beginAnimations:nil context:NULL];
// setting duration of the animatio
[UIView setAnimationDuration: 0.2];
// setting new value for the switch
resSwitch.on = how;
// commiting the animation for execution
[UIView commitAnimations];
}
We had to disable comments till the problem with spam will be solved, sorry for any inconvenience caused.