The following code is sheer simple. _facebookF is a UIImageView.
if (animationOn == YES) {
[UIView animateWithDuration:0.4 animations:^{
[_faceBookF setAlpha:0];
}];
[_faceBookF setImage:[UIImage imageNamed:@"facebookFBlue.png"]];
[UIView animateWithDuration:0.4 animations:^{
[_faceBookF setAlpha:1];
}];
} else {
[UIView animateWithDuration:0.4 animations:^{
[_faceBookF setAlpha:0];
}];
[_faceBookF setImage:[UIImage imageNamed:@"facebookF.png"]];
[UIView animateWithDuration:0.4 animations:^{
[_faceBookF setAlpha:1];
}];
}
The app gets to the method which contains this code fine, but no changes to the UI occur throughout the entire block of code. To my knowledge, the app is running on the main thread.
Any guesses?
UPDATE–In fact, the issue is that the image is not being changed at all–with or without the animation. Both images are accessed fine in other parts of the app.
Thanks for your responses. I’ve implemented the completion block you both mentioned to avoid both animations firing at once. However, the main issue had to do with the method not being accessed properly. I can’t see exactly why, as the
facebookFvariable was not nil, and the if and log statements in the method worked fine. Anyway, I have switched to aNSNotificationsolution, and now all parts of the method are being accessed.