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

标签 iphone objective-c ios xcode uilabel

<分区>

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

我试过下面的代码:

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

但返回时出现以下错误:

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

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

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

关于iphone - 如何在 if 语句中检查 UILabel 的值是否大于 0?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8348478/

上一篇:ios - 从 CoreMotion 的姿态旋转矩阵中分离并移除水平旋转

下一篇:iphone - Objective C iPhone 开发,保存和检索 NSMutableArray

相关文章:

iphone - 将 2 个 UIImage 合并为一个,其中一个被旋转

iphone - 如何使用 UIImagePickerController 只录制音频?

iphone - UILabel 不会更改 setFrame 上的高度

iphone - 两个日期之间的范围的 NSPredicate 没有按预期工作

ios - 太多的文字将我的按钮推到屏幕下方

ios - 将正数转换为负数 - iOS

ios - 如何在 CGContext 中旋转 NSString drawinrect

ios - UIImagePickerController 添加文本到图像

ios - 从 iOS 9.x 升级到 iOS 10 后本地通知不出现

Objective-C:如何从 UIWindow 中只删除一个 subview ?