I have an UISwitch
which is inside of a UITableViewCell
. I have a target action assigned to switch:
[switch addTarget:self action:@selector(changeSwitchColor:) forControlEvents:UIControlEventValueChanged];
- (void)changeSwitchColor:(id)sender
{
...
}
The problem is that the changeSwitchColor:
is called before the animation is finished, yet I want to detect when animation has finished, so I can set the thumbTintColor
property without breaking the animation.
My attempt to detect the animation by using UIView
setAnimationDidStopSelector:
method:
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
{
...
}
But this method is not called on UISwitch
finishing the animation (I'm not even sure how the animation is made internally).
How could I detect the finishing state of UISwitch
?
Thanks!