Open markbeaton opened 12 years ago
I can confirm this behaviour as well.
I solved it by setting the value AFTER the addTarget call. So
[toggle addTarget:self action:@selector(aSelector:) forControlEvents:UIControlEventValueChanged];
toggle.on = someBoolean;
@jyn 's solution worked. Thank you!
thanks so much for this :)
@jyn 's solution worked for me as well. Thank you indeed :+1:
@jyn thank you so much ,, you saved mi day :)
@jyn is my hero!
If you add a target immediately after setting the "on" property, there's an EXC_BAD_ACCESS triggered when the switch slide animation completes.
E.g.
Perhaps something to do with the
[[self allTargets] makeObjectsPerformSelector:@selector(retain)];
and[[self allTargets] makeObjectsPerformSelector:@selector(release)];
in the property setter - i.e.[self allTargets]
is empty when the animation begins, but has the new target when the animation completes, causing an over-release?