下面的代码:目标C检查是否文本字段为空
- (IBAction) charlieInputText:(id)sender {
//getting value from text field when entered
charlieInputSelf = [sender stringValue];
if (charlieInputSelf != @"") {
//(send field if not empty
}
}
这将是即使该字段为空;因此,这不符合我的要求。
空我觉得堆栈已经变得比一个更有参考价值任何主要平台的官方文档 – ChuckKelly 2014-02-08 09:55:50
其实如果textField是零,那么textField.text.lenght == 0.所以你可以减少if: if(textField.text.lenght> 0)' – 2015-01-19 21:01:52
这两个条件是相互依赖的。只保留一个条件。因为0&0 = 0,1&1 = 1 – Saranjith 2017-07-31 06:58:47