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.
Related
We are working on xamarin.ios app. Here we have design two different view one for portrait and another is landscape view in asingle view controller. Both view have a text field. We are loading view according to device orientation. Everything is good but when we start typing in text field, Keyboard up and auto dismiss while we type a very fist character. Again we focus on text field, keyboard appear but dismiss when we press any letter.
One thing that I have noticed, When we tap on keyboard key “ViewDidLayoutSubviews()” event call and view reloaded.
Can you please guide me to solve this issue.
From what I can tell you are probably calling an event driven function when the text field is updated in such a way that it dismisses the keyboard? If this assumption is right, make sure that you are only adding the event to the text field once. Also make sure that the event you are calling isn't updating after every key stroke. You may need to use the event textbox.EditingDidEnd to run whatever function you want as soon as the user is no longer typing into the text field. I can update the answer with more specifics if i can see the actual code.
We have solved it logically by using flags. We have declare a boolean flag isKeyboardAppear=false when view appear first. When keyboard appear we set this flag to true And we noticed ViewDidLayoutSubviews() method are calling on every key press, so we write this code
public override void ViewDidLayoutSubviews()
{
base.ViewDidLayoutSubviews();
if (isKeyboardAppear == true)
{
return;
}
}
When we hide keyboard manually we reset flag isKeyboardAppear=false .
Have set up two labels and two text fields in my .xib file, and set up two properties (nameField, numberField) to hold the data for the text fields.
Have also configured the two text fields.
Problem is that when I run the app in iOS Simulator and click in either of the text fields, no cursor shows up, and the keyboard doesn't pop up.
What's wrong?
Thanks in advance.
Have you connect your textField's to IBOutlet? If yes and this still not working you can use gesture recognizer. Add UITapGestureRegogniser to your textField and call the method:
[self.textField becomeFirstResponder];
I hope this help
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
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 don't want to connect action to button, I want when user clicks text that says "Insert" to highlight that text (or change color) and call a function.
How to do that?
UILabel doesn't have a function inherently that you could use, however the UITextField has a property called editing that is called when the user taps the text. This may or may not be what you're looking for because the keyboard is usually open during editing of a text field.
In my honest opinion, it really would be easier to use a button in the long run. It's much less work to put an invisible UIButton on top of the text and check to see if the user taps that.