如果 UITextField 中没有任何内容,我无法使用 IF 命令来清除 UILabel
我有一个 iPad 应用程序,将此作为我的代码的一部分:
if (NAME1.text == @"") {
SS1.text = @"";
SPA1.text = @"";
}
但如果 UITextField
中没有任何内容,它不会清除 UILabel
!
有谁知道我怎样才能让它做我想做的事?
I have got an iPad app with this as part of my code:
if (NAME1.text == @"") {
SS1.text = @"";
SPA1.text = @"";
}
But it does not clear the UILabel
if there is nothing in a UITextField
!
Does anyone know how I can get it to do what I want?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查字符串的
长度
,不要进行直接指针比较:Check the
length
of the string, don't do direct pointer comparison:应该是:
If ([NAME1.text isEqualToString:@""])
Should it be:
If ([NAME1.text isEqualToString:@""])