Please need help : I have two textfield in a view , save button and done button. now first time when I run my app, and type in a textfield the keyboard apperas good and I can save. but when I press done button to exit that view , the keyboard don't appears any more in any other part in my app.
just a shot in the dark here, but try to use
[textField resignFirstResponder];
in the done action
Related
I added textfield (keyboardTextField) on top of my custom keyboard.
I can select it and enter some text (using my custom keyboard). But it's impossible for me to select the input view of the main app back.
This line of code
[keyboardTextField resignFirstResponder];
doesn't work correctly. If someone have any workaround or any ideas, I need your help.
I fixed this by adding a button which switches the user input from the UILabel (in my case) to the (normal - iOS) UITextField in Messages f.e.
I check on a BOOL to see where to enter the user selected character.
I have a one UIButton with a value, when you start the app, the TitleLabel of the button has been Hidden “call” (button.titleLabel.hidden=YES).
I have connected the button with a one IBAction (TouchDown) for when the user press the button appear the value / “call” (button.titleLabel.hidden=NO) and disappear with one NSTimer in 3 seconds after call (button.titleLabel.hidden=YES)
If you press one time the button is work good, (appear and disappear) but when you press without release the button and you move outside area and return inside area of the button the Value of Title appear again. Not work (button.titleLabel.hidden=YES)
I tested with another IBAction (Drag enter, Drag exit) in parallel to force the (button.titleLabel.hidden=YES) but the Value of the Title appear. Also take out the Timer but not working…
Please could you help me.
Thanks
Edit.
you must have created the button via Storyboard/XIB. Please check the sent events by right-clicking the button and set it to touch down. This should resolve the problem. :)
Is there anyway to fire the "touch on UITextField" event? Because I would like to place a button that, if pressed, sets the focus on a specific UITextField and starts editing.
Thanks.
Call [textField becomeFirstResponder]; when user pressed on the button you want.
I need to display/show a Picker when a user taps on a textfield, I mean, it should appear a picker instead of a keyboard. Also, some sort of "done" button above the picker so the user clicks on it and the value from the picker is copied to the textfield and the picker is hidden again.
I've checked many tutorials from the web but haven't found anyone that can really help me.
I found a tutorial that pointed me in the right direction but I'm still missing to disappear the keyboard when clicking on the textfield.
Dismissing UIPickerView with Done button on UIToolBar by #slev
Any ideas?
If you're not targeting iOS versions older than 3.2, it's easy. You can either assign the UIPickerView as the inputView property of the UITextField and the UIToolbar containing the 'done' button as the inputAccessoryView, or you could make a single UIView that has both the picker and the toolbar as subviews and assign that as the intputView (and leave inputAccessoryView as nil). Either way, this will animate your picker in in place of the normal keyboard when the text field is activated.
More details on this are available in the documentation.
I have an ipad app that when you are in landscape view, the view will move up when the keyboard is brought in. When you press done on the keyboard, textFieldShouldReturn and textFieldShouldEndEditing are called in which case, I move the view down in shouldEndEditing.
If the user presses the dismiss keyboard button, the keyboard does poof, yet the view is still stuck floating where I moved it.
I need to know how or what function is called when that button is pressed so I can redirect the function to textFieldShouldEndEditing.
Thanks!
You can listen for keyboard hide UIKeyboardWillHideNotification notification.
Example code is here http://developer.apple.com/iphone/library/samplecode/KeyboardAccessory/Listings/Classes_ViewController_m.html
When the "lower keyboard" button is pressed, the textfield delegate method of:
-(BOOL)textFieldShouldReturn:(UITextField *)textField
Won't be called.
When either the "lower keyboard" or "return button" are pressed, the:
-(void)textFieldDidEndEditing:(UITextField *)textField
Will be called.
I use a variable NSString *lowerKeyboardButtonPressed initially set to #"" which I set to #"N" in the textfieldShouldReturn method ... then in the textFieldDidEndEditing method I check to see if it is set to #"N" ... then I know if the return key or lower keyboard key was pressed. The last line in my textFieldDidEndEditing method sets the variable back to #"".
If you press the keyboard dismiss button and you have a hardware keyboard attached, then the willHide will only be called if you don't have an input accessory view. At which point you need to adjust in the willShow as well (which will have a negative difference between the UIKeyboardFrameBeginUserInfoKey and UIKeyboardFrameEndUserInfoKey keys).