Hello.
I'm Aleksandar Vacić, professional web developer and wine maker in the making.
Learn more about me or see what I can do for you.
If you have UITextField on the page and you need to validate is there something in it (so if yes you can save the input or something), you might do something like this:
if (![addNewCellTextField.text isEqualToString:@""]) { … }
However, this will fail if the field is never touched. That is, until your user taps the field and it gets focus, UITextField.text is nil. Which means that condition above yields true, which is not what you want.
Once it is touched though, this becomes an instance of NSString with value of @””. Thus, always use:
if (addNewCellTextField.text != nil && ![addNewCellTextField.text isEqualToString:@""]) { … }
Watch out for this little trap hole.
Lots of ramblings on this blog...might be easier for you to find your juice through these tags:
Voices from the crowd, one so far
by Brandon
3 weeks, 3 days after the post