I wanted to change the name of the return button key as I'm not developing the app in English. I'm having an UIAlertController and added a textField (.addTextFieldWithConfigurationHandler { (textField) -> Void in <someCode> }). How can I now change the title of the return button key in Swift? Actually there shouldn't be any difference to a normal UITextField. Thank for any help :]
You cannot set custom text for the return key on iOS. There are a number of options but those are the only ones.
If you are only worried about translation, the keys will be translated automatically depending on the language that is configured on the users device. Otherwise, you are going to have to create an entirely custom keyboard (which is almost certainly not worth the effort).
Related
when we click the text field, the default keyboard or keypad not to be appear instead i need to display the custom keyboard..
Did any one know the answer please post it..
Declared in
UIResponder.h
UIInputViewAudioFeedback protocol.
Is this method correct or else there having any simple method to work out?
You need to create a protocol for this for having a custom keypad appearing throughout the app. I have made it few months back and the stuff was working well. My requirement was to create a keyboard for farsi language, because ios does not have farsi in its language settings.
There is no need to make protocol if you want it in just 1 viewcontroller.
Here is my that thread:
customized keypad on the iPhone Application
Here's something that I created that might help. Just fork it on GitHub and change the Punjabi characters to Myanmar. Most of the hard work is done for you :)
https://github.com/kulpreetchilana/Custom-iOS-Keyboards
Per your comment you need the Number Pad keyboard.
Set your UITextField keyboardType property, either via Interface Builder or programmatically:
textfield.keyboardType = UIKeyboardTypeNumberPad;
Could you please help me out in entering the text in search bar using UIAutomation scripts for IPhone Application.
Thanks in advance,
Madhu.
UIASearchBar inherits from UIATextField:
http://developer.apple.com/library/ios/#documentation/ToolsLanguages/Reference/UIASearchBarClassReference/UIASearchBar/UIASearchBar.html#//apple_ref/doc/uid/TP40009913
Try the "setValue" method:
searchBar.setValue("search for this");
Since through tap input method you communicate with the device, you can try user-like type of action: tapping.
To bring up the keyboard you just tap on the text input field:
someTextInputField.tap();
But be aware of the fact that there is no keyboard object instance available for actions if you do not activate the keyboard itself by tapping on any text input field.
Once the keyboard is activated:
var App = UIATarget.localTarget().frontMostApp();
var Keyboard = App.keyboard();
var Keys = Keyboard.keys();
var AltKeys = Keyboard.buttons();
Where AltKeys represent service buttons like Shift, Done, etc.
And Keys represent all other buttons.
P.S. Keep in mind that you have to switch between keyboard tabs to get access to either characters, numbers, special characters.
Is there a way to use the keyboard with "Go" key instead of the "Return" key like when you are accessing login fields in Safari? I'm guessing this should be something trivial but my searches aren't turning up anything. :(
Thanks in advance.
For a UITextField or editable UITextView:
[myTextField setReturnKeyType:UIReturnKeyGo];
You can also configure this in Interface Builder, under Text Input Traits for your text field/view:
In Xamarin.iOS or Monotouch is:
myTextField.ReturnKeyType = UIReturnKeyType.Go;
Possible values are:
Default
Go
Google
Join
Next
Route
Search
Send
Yahoo
Done
EmergencyCall
Continue
myTextField.returnKeyType = UIReturnKeyType.Go
Other options for return key name can be found at: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/#//apple_ref/c/tdef/UIReturnKeyType
You can use this simple way: [textField setReturnKeyType:UIReturnKeyGo]; instead of "Add" button.
Other, you create a programmatically keyboard with buttons which you want.
I have an app that uses UiWebViews, and I need to not show the keyboard for a text field within such a view. I provide my own buttons that insert the limited sorts of text the field allows, but I also need to allow pasting (I will filter what gets pasted) and adjusting the cursor position. Any way to do this?
It looks like this can't be done, I've researched it further and that's pretty clear. I don't want to accept a wrong answer, so I figured I'd just answer this myself and say: can't be done.
if you just want the textField do normal things except the showing keyboard action, you could subclass UITextField and overwrite the touchesBegan/Moved/Ended, just call super touchesBegan/Moved/Ended and add additional code which would hide the keyboard, if you have a reference to the keyboard ( you may figure it out urself how-to ), call the method : [keyboard resignFirstResponder], you may try to Category the UITextField class so you would have the reference to the keyboard ( if it's private ) - but not recommended because categorying may break our project design, but if you just need it for the only purpose, give it a try. Hope it helps.
Is it possible to set custom return key type for UITextField?
[txtField setReturnKeyType:UIReturnKeyDefault];
I want to have the word "SHARE" in place of the return key type.
Thanks
Nope. You get the return key and keyboard types defined in the OS. Unless you want to try to hack the keyboard's view hierarchy to change that button, which would be a really bad plan. (Standard recommendation here is to file a bug report with Apple to let them know you'd like more/different options.)