Note that there are some explanatory texts on larger screens.

plurals
  1. POIPhone app xcode, trying to hide text input by clicking on the background?
    primarykey
    data
    text
    <p>I'm following an example in Beginning Iphone Development 4 for basic user interaction.</p> <p>I'm using xcode 4.02 with sdk 4.3</p> <p>I have a basic viewcontroller.xib with two textbox's, one for numeric values and another for text. Once I'm finished editing either of the text fields I wish to tap the background and have the keypad disappear.</p> <p>The books says to change the container UIView object to a UIControl and then add an action onto the UIControl event Touch Down. Then create a method to resign the first responder of each of the textbox's and link this to the touch down event. I've done this. Here is my code, is there anything I've missed? At the moment nothing happens.</p> <p><img src="https://i.stack.imgur.com/MPA9P.png" alt="enter image description here"> Thanks</p> <pre><code>@interface ControlFunViewController : UIViewController { UITextField *nameField; UITextField *numberField; } @property (nonatomic, retain) IBOutlet UITextField *nameField; @property (nonatomic, retain) IBOutlet UITextField *numberField; - (IBAction)textFieldDoneEditing:(id)sender; - (IBAction)backgroundTap:(id)sender; </code></pre> <p>Implementation:</p> <pre><code>#import "ControlFunViewController.h" @implementation ControlFunViewController @synthesize nameField; @synthesize numberField; - (void)dealloc { [nameField release]; [numberField release]; [super dealloc]; } - (IBAction)textFieldDoneEditing:(id)sender { [sender resignFirstResponder]; } - (IBAction)backgroundTap:(id)sender { [nameField resignFirstResponder]; [numberField resignFirstResponder]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload