UITextField keyboard doesn't appear
I have a very simple screen with an UITextField with the default configuration, nothing special.
When I touch the UITextField, the keyboard doesn't pops up. I haven't any custom control, behavior or anything else, just that, but it doesnt'work. I've done this in previous apps iPhone/iPad apps already on the AppStore but i can't figure out what's going wrong here.The UITextField is created in Interface Builder, in the nib file.
I've been doing some research and i added an IBAction in the UIViewController fo开发者_如何学编程r UItextField TouchDown event and the IBOutlet for the UITexField. In the first line of the code i added:[textFild becomeFirstResponder];
That's the default behavior of the UITextField, when you touch it, it becomes the first responder asking the system to show the keyboard.
I debugged it and it runs that line, but the keyboard still doesn't shows up. Thanks in advance.Many times your code is right, it's just about the settings of your Xcode or the Simulator.
Try Toggling Keyboard Software in the Simulator
Simulator --> Hardware --> Keyboard --> Toggle Software Keyboard
OR just simply hit Command + K
it would do the same thing
One thing you should check is to make sure the containing view (the UIView that contains all the controls), which is the View icon in Interface Builder nib viewer, has User Interaction Enabled checked. If the parent container doesn't have this checked, even if the individual controls do, you will see this behavior.
I already figured out by myself! I had tha UITextField in a UIViewController that gets presented from another view controller who responds to motion events, and that previous View Controller was allways the First Responder. All I had to do was everytime i leave the controller's view in viewWillDisappear:(BOOL)animated, i called [self resignFirstResponder]; and that was all.
I took me a while to find this silly oversight, but make sure that both properties of UITextView: selectable and editable are set to true.
Its a pretty basic thing but make sure your USER INTERACTION and ENABLED are checked in the storyboard editor.
精彩评论