views:

483

answers:

2

Is there a way of clearing all test fields when selecting a text field to enter text with the keyboard.

For instance if you had a tip calculator that you have already run once, and all the fields are now populated.

Now when you want to run another calculation, you click on the text field an all the other fields are automatically cleared also.

Hope this makes sense. Steve

+1  A: 

Your view controller should implement the UITextFieldDelegate protocol. Then add the -textFieldShouldBeginEditing: or -textFieldDidBeginEditing: method to your view controller. In your nib file or when you create your text fields, set their delegate properties to your view controller.

Then when the -textFieldShouldBeginEditing: or -textFieldDidBeginEditing: method is called, you can clear all your text fields if you're app is ready to start a new calculation.

Don McCaughey
A: 

You probably want to tag this (and your subsequent questions) "cocoa-touch", because they're about the use of the APIs in the Cocoa Touch framework for the iPhone OS, rather than "xcode" (which is just a development tool).

cdespinosa
That should be a comment, not an answer.
Peter DeWeese