UITextField keyboard doesn't appear - iphone

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 for 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.

Related

Cannot get button to call controller code iPhone 4

My View has a button, myButton, in my XIB. In the XIB the File's Owner is of class HelloWorldViewController. And the view for File's Owner is my View in the XIB.
In the HelloWorldViewController(which resides in MainWindow.XIB) I have - (IBAction) doMyButton:(id)sender and I have the corresponding definition in the HelloWorldViewController.h file.
For my View I have Events (again in the XIB) Touch Up Inside --> File's Owner doMyButton.
For File's Owner I have Received Actions doMyButton --> Rounded Rect Button Touch Up Inside.
I have a debug point on the first line of code that is inside the 'doMyButton' method. When I touch the button (with my mouse in the simulator) I do not hit my break point.
WTF?
Screen Captures of IB if it helps:
Overview
Properties Of Button
If every thing is fine then you are not setting the break point i.e. you are running your code using cmd+R use cmd+y or cmd+enter. cmd+r will run without considering your break points.
Do any of your IBOutlet items function?
If they don't (and since you renamed your XIB file), be sure the File's Owner has the correct custom class set in the interface builder. Otherwise it could be calling the wrong class which could be why your break point isn't firing.
Note: This is unlikely as such an issue should cause a build problem, but I've seen stranger things happen.
Thanks to a co-worker I found out what the problem was. The view I had with the button was in my HelloWorldViewController.xib as it is supposed to be. However, I had drug that view into the Main.xib to be the primary view for the NavController I had setup. I was editing the view in the HelloWorldViewController.xib when I should have been editing (read: making the connections) in the Main.xib where the view was duplicated for the NavController.
I assumed that NavController was simply pointing to the other XIB where my original view was defined, not running off a copy of it. Kind of messed up for a newb perspective.

can not show input method pane in UIWebView

I have created a simple UIViewController, and set a UIWebView as a default view.
When I inserted it into a NavigationController, it did not show input method anymore if I click in some text field in page.
Any ideas?
input method = soft keypad,
ps: i set the simple UIViewController as rootViewController of MainWindow, also take no effect. can not show soft keypad too.
I just encountered this. For me, the keyboard is apparently sitting behind my web view. I happened to rotate the device (in the simulator) and noticed, during the screen rotation drawing process, that I could see parts of the keyboard behind my webview. [Quoted] [1]
Interestingly, I can't seem to reproduce this problem in a freshly created sample application - yet I can't see what the problem can be with my view hierarchy. [Quoted] [2]
[1][2]: Reference
Is your web view in a modal view controller?
Pls check if the userInteraction is enabled for the web view. If not you can set it by
yourWebview.userInteractionEnabled = YES;

iPhone: how can I activate a text field programmatically (and not wait for the user to touch it)

I have a UIViewController that is a UITextFieldDelegate, and I would like the keyboard for its text field to appear as soon as the user navigates to this view, without having to actually touch the text field. It would also be nice to be able to "dismiss" the entire view when the keyboard is dismissed. I am loading the view from a xib file.
I don't have an ivar in the code for the UITextField as yet. I would guess I need one. At this point I am just relying on the delegate to pop up the keyboard.
(I know its not a UITextViewDelegate, like the tag says, but I am new to stackoverflow and can't create the correct UITextFieldDelegate tag.)
Sounds like you want to use [textField becomeFirstResponder] in viewDidAppear.

Is it possible to make the iPhone keyboard invisible / remove it without resigning first responder?

I am looking for a way to show my own input view (a UITableView) to enter certain keywords in a UITextView faster than typing them, and also be able to type into this text view the normal way. My solution has a button that causes the keyboard to disappear, revealing the table view underneath it.
Problem is I can't figure out how to make the keyboard go away without resigning first responder, and losing the cursor. Has anyone accomplished this before?
Thanks for any help.
Nope
As far as I know there is no way to do this, and I have searched extensively. Very frustrating that selection and the cursor are restricted to the keyboard.
I could be wrong though. Votes? Suggestions?
You can call becomeFirstResponder on some other thing that you choose. It could be a UIViewController or a UIView. I had a similar problem before, I needed to make my keyboard go away when I was pushing my view controller back to its caller, without knowing which textfield was the first responder. Then, on viewWillAppear of my view controller which I was returning back, I called [self becomeFirstResponder] and the keyboard of the pushed view was gone. Because this made whichever text field was it loose being the first responder.

UITextFieldDelegate != IBAction backgroundTap

The scope of this question is IPhone 3.1 sdk (app running in simulator still)
I have a table view that has a cell with a UITextField in that cell. The table view is grouped, and has one section with just a couple fields. Im NOT using IB so backgroundTap is out of the question (as far as i can tell at least). When i click the text field, keyboard shows. Hiding it is still troublesome. Ive pulled the UITextFieldDelegate into the mix to hide the keyboard but the textFieldShouldEndEditing method doesnt seem to fire when the background is tapped (when i mean background, im tapping outside of the grouped table view section). First off, should it?
textFieldShouldReturn fires with no problem and i can resign at this point but shouldnt i be able to resign if focus shifts away from that control?
Any help is much appreciated
-me
Generally you'll only stop editing a field when you:
hit the "Done" or action button on the keyboard
begin editing another field
exit the view
have another button on screen that removes focus
From any of these, you can call -[textField resignFirstResponder] to dismiss the keyboard and call your -textFieldShouldEndEditing: method. There's no reason that just tapping on a non-active part of the screen should dismiss the keyboard.