When dealing with user form, I was looking for the best way to form check. Coming from a web background, I’m used to doing it with javascript/ajax requests. In an if elseif statement that activate a button with all input field are not !== “”
To access the inputed iphone text from a uitext field:
myUITextField.text
To compare that input text to a string
[myUITextField.text isEqualToString:@"This String"]
I’m starting to fall in love with apples objective-c in the xcode environment, Apple got it right.
When the the form checking is complete we will post the code.
2 comments ↓
If you found this post useful click the share this button. Contribute below by adding a comment, no registration is required.
DCE Related Posts
A function that validates user has inputted text into the UITextField and executes a submission function on the iPhone using Xcode on Required Fields Read Full Article...
How to have a UIlabel print out a float value using stringWithFormat:@"$%3.2f" Read Full Article...
One of my CoreData applications started acting buggy, and was spitting out a huge error dump on app close in the debug console. Read Full Article...
[...] rest is here: Compare UITextField Input to String (iPhone Development) | Design … Share and [...]
That is a beautiful thing. The Apple doc for UITextField states that the default value for textField.text is nil, but validating against that can be a nightmare if you’re trying to do it in real-time against ‘Editing Changed’ events. This little method irons out all the ==nil, ==”", ==@”", comparisons very nicely.
Leave a Comment