应用程序从后台返回后,UIButton imageForState 不正确 [英] UIButton imageForState is not correct after the app returns from being in the background

查看:26
本文介绍了应用程序从后台返回后,UIButton imageForState 不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 .h 文件中声明了一个 UIButton

I have a UIButton declared in the .h file as

@property (retain, nonatomic) IBOutlet UIButton *btnQuarter;

当我有

if ([self.btnQuarter imageForState:UIControlStateNormal] == [UIImage imageNamed:@"match.png"])

应用一加载就完美运行.但是,当应用从锁定状态或在主屏幕上返回时,它不起作用.

as soon as the app loads it works perfectly. However when the app returns from being locked or being on the home screen it doesn't work.

推荐答案

试试这个代码:

 - (IBAction)nextQtr:(id)sender

   {
    if ([[sender imageForState:UIControlStateNormal] isEqual:[UIImage imageNamed:@"match.png"]])

   }

这篇关于应用程序从后台返回后,UIButton imageForState 不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆