Friday, 6 September 2013

Check UITextFields for text

Check UITextFields for text

There is a view controller on my app in which the user enters personal
information. There is a cancel option that pulls up an alert notifying
them they will lose the data if it is not saved. I only want to display
this alert if any text field in this view controller has [.text.length >
0] (I have about 20 text fields, if any have even 1 character it should
pull up the alert). I could manually name every text field in an if
statement but was hoping there was some way to check all the text fields
in my view controller?

No comments:

Post a Comment