vendredi 9 octobre 2015

How to change text field text using if/else if string is NULL or 0?

Below is my code:

if(PREREQUISITEstring == (NSString *)[NSNull null] || [PREREQUISITEstring isEqual: @"0"]) {
  PREREQUISITEfield.text = @"2";
} else { 
  PREREQUISITEfield.text = PREREQUISITEstring;
}

I am 100% sure that PREREQUISITEstring is "0" and it shows as "0" when I'm debugging but when it comes to runtime, that string doesn't change to 2, it stays as 0.

Aucun commentaire:

Enregistrer un commentaire