I only know few ways to show a keyboard on iOS
touch textfield,search bar,textview.....
Is it can via touch a button to show keyboard ???
I wish I can use this way to set a button tittle if the button is no tittle or can rename it.
Thank you guys~
The documentation for the UIKeyInput protocol says the following:
A subclass of UIResponder can adopt this protocol to implement simple text entry. When instances of this subclass are the first responder, the system keyboard is displayed.
Only a small subset of the available keyboards and languages are available to classes that adopt this protocol.
So this might serve your needs better than a hidden text field/view.
You need to add an UITextField
to your view and call then [myTextfield becomeFirstResponder];
Its possible to set the hidden attrribute from UITextField
to YES
- so the user will never see the textfield. After Keyboard input is finished you can remove the UITextField
with removeFromSuperview
.
Maybe a little bit dirty, but thats the solution I used often. I wonder if the SDK provide another possibility.
You need some form of input method like a UITextField
in which you can input a name for your button. If you want, you could create a UIButton
that shows the textField (have it hidden by default) and makes it first responder by doing:
textField.hidden = NO;
[textField becomeFirstResponder];
Once you enter something you want in your text field, you can make it so the keyboard disappears, the textfield is hidden, and the UIButton
text is changed to the text entered.
-(BOOL)textFieldShouldReturn:(UITextField*)textField; {
textField.hidden = YES;
[textField resignFirstResponder];
[yourButton setTitle:textField.text forState:UIControlStateNormal];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With