我在自定义 UISwitch DCRoundSwitch 的选择器方法中完成了以下动画代码。
if ([[[App.remindersArray objectAtIndex:0] objectAtIndex:3]isEqualToString:@"YES"]){
[firstReminderOnOffButton setSelected:YES];
[swtchDailyReminder setOn:YES];
imgviewDailyReminder.image=[UIImage imageNamed:@"nDailyReminder_On_1.png"];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.35];
[UIView setAnimationDidStopSelector:@selector(animateFadingIn)];
[UIView setAnimationDelegate:self];
imgviewDailyReminderAnimation.alpha = 1.0;
[UIView commitAnimations];
}
else
{
[firstReminderOnOffButton setSelected:NO];
[swtchDailyReminder setOn:NO];
imgviewDailyReminder.image=[UIImage imageNamed:@"xDailyReminder_OFF.png"];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.35];
[UIView setAnimationDidStopSelector:@selector(animateFadingIn)];
[UIView setAnimationDelegate:self];
imgviewDailyReminderAnimation.alpha = 0.0;
[UIView commitAnimations];
}
问题是从普通 UISwitch 调用上述代码时动画可以正常工作,但从 DCRoundSwitch 调用时无法正常工作。
还尝试通过使用 UIView 块动画来解决....但仍然面临问题。
请指导我。