如何在if语句中检查UILabel的值是否大于0? [英] How can I check if a UILabel's value is more than 0 in an if statement?

查看:159
本文介绍了如何在if语句中检查UILabel的值是否大于0?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在if语句中检查UILabel的值是否大于0?

How can I check if a UILabel's value is more than 0 in an if statement?

我尝试过以下代码:

if(ArtCount.text.intValue > 0)
{
}

但它返回时出现以下错误:

But it comes back with the following error:

2011-12-01 20:52:50.124 iDHSB[2955:707] -[UILabel isEqualToString:]: unrecognized selector sent to instance 0x1a9860
2011-12-01 20:52:50.126 iDHSB[2955:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-    
[UILabel isEqualToString:]: unrecognized selector sent to instance 0x1a9860'
*** First throw call stack:
(0x323e28bf 0x35cfa1e5 0x323e5acb 0x323e4945 0x3233f680 0x3152b191 0x6cff3 0x316cf871 0x323e5814 0x323407e1 0x323403ff      
0x34767e5b 0x323e4ab3 0x3233f680 0x323e5814 0x323407e1 0x33dcb43d 0x33dde8dd 0x323b6b03 0x323b62cf 0x323b5075 0x323384d5 
0x3233839d 0x378b7439 0x315558e1 0x2d0f 0x2758)
terminate called throwing an exception[Switching to process 7171 thread 0x1c03]
(gdb) 


推荐答案

错误消息:

[UILabel isEqualToString:]: unrecognized selector sent to instance 0x1a9860
2011-12-01 20:52:50.126 iDHSB[2955:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-    
[UILabel isEqualToString:]: unrecognized selector sent to instance

表示导致异常的行正在调用方法 isEqualToString UILabel 的实例上,提供的代码不包含此方法调用。

indicates that the line that caused the exception was calling the method isEqualToString on an instance of UILabel, the provided code does not contain this method call.

UILabel 实例上查找调用 isEqualToString 的语句。

Look for the statement that is calling isEqualToString on a UILabel instance.

这篇关于如何在if语句中检查UILabel的值是否大于0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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