Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Neither keyboard nor cursor are appearing when a UITextField is tapped

I am testing out a simple application on Xcode 5.0.2. Using storyboard, I've dragged two view controllers that are connected by segues. On first view controller there is a button, after pressing that button next controller shows up which has two textfields. When I tap the textfield, the keyboard is not showing up and the text cursor is missing.

textFieldViewController.h file

@property (weak, nonatomic) IBOutlet UITextField *nameField;

@property (weak, nonatomic) IBOutlet UITextField *numberField;

- (IBAction)textFieldDoneEditing:(id)sender;


- (IBAction)backgroundTap:(id)sender;

textFieldViewController.m file

 - (IBAction)textFieldDoneEditing:(id)sender {
    [sender resignFirstResponder];
}

- (IBAction)backgroundTap:(id)sender {
    [self.nameField resignFirstResponder];
    [self.numberField resignFirstResponder];
}

screenshot enter image description here

like image 884
hellosheikh Avatar asked Feb 17 '14 11:02

hellosheikh


2 Answers

This can also happen with Xcode 6/iOS 8 because of simulator settings:

Xcode 6: Keyboard does not show up in simulator

like image 197
MaryAnn Mierau Avatar answered Nov 14 '22 23:11

MaryAnn Mierau


Make sure that your UserInteraction of UITextfield is Enabled and you didnot have any view on your Textfield.

like image 30
jayraj m.g. Avatar answered Nov 15 '22 00:11

jayraj m.g.