我在此链接中提到了相同的问题,但我无法找到解决方案。
当我的应用程序从后台返回时, imageForState
不正确。
UIButton imageForState is not correct after the app returns from being in the background
代码:
UIImage *img = btn.currentImage;
if ([img isEqual:[UIImage imageNamed:@"abc.png"]]) {
[btn setImage:[UIImage imageNamed:@"pqr.png"] forState:UIControlStateNormal];
}
else {
[btn setImage:[UIImage imageNamed:@"abc.png"] forState:UIControlStateNormal];
}