NSString *temp = [textField.text stringByTrimmingCharactersInSet:[NSCharacterSetwhitespaceCharacterSet]];
//看剩下的字符串的长度是否为零
if ([temp length]!=0) {
...
}