How to create an if statement that checks if the text field is empty?


I have three text fields, lets name them:

  1. textField1.
  2. textField2
  3. textField3

I want to write an if statement if the value (integer) of textField1 is changed to set textField2 and textField3 to equal 0 if they have no number entered within them.

Likewise with textField2 to change textField1 and textField3, etc.

I have tried to check if

 textField2 = nil;
    if textField2 = @""

Neither work!

How do I do so?

The best way to check if a text field has any text is to do:

if (textField2.text.length == 0) {
    // no text