I've been looking around and digging into my code without success so far so I'm asking here.
I added two buttons to a textField's keyboard as such :
emailTextField.addRightLeftOnKeyboardWithTarget(self, leftButtonTitle: "action_dismiss".localized, rightButtonTitle: "action_send".localized, leftButtonAction: #selector(dismissEmailTextFieldKeyboard), rightButtonAction: #selector(didTabSendButton))
This textfield is where the user enters his email. I already have a predicate that checks the validity of the email typed in by the user. That serves as an interaction enabler/disabler for my main send button.
I made a shortcut send button on the keyboard for UX purposes, and I would like it to be subjected to the predicate and to be disabled until the email typed in is correct.
So here is my issue, I do not find a way to access the keyboard's toolbar's buttons as properties in order to disable their interaction. Could anyone point me to the right direction please ?
Thanks in advance
Related
I have a weird problem i am facing with. I know about OTP autofill with
textField.textContentType = .oneTimeCode .
But i have a different problem, i want this autofill to work but the text field should be disabled for any manual typing.
Basically , user gets message with OTP on his/her phone and OTP gets autofilled by using .oneTimeCode. But in any case if the app can't read or find OTP through this method(from SMS) , the user should NOT be allowed to manually enter the OTP.
Is there anyway to attain this scenario ?
You can set a transparent view on textField & make its userInteraction disable. & for showing keyboard automatically you can use textField.becomeFirstResponder()
You need to disable userInteraction of view that is on your TextField:
transparentView.isUserInteractionEnabled = false
And for display keyboard automatically:
Yoy can write this line in viewWillAppear method when your otpScreen appear.
textField.becomeFirstResponder()
At first glance, my suggestion will be adding clear view to block the text field touch, but this will prevent filling the OTP
Disabling user interaction will be preventing filling the OTP too.
Maybe you can use text field delegate on text change, check the new characters. When the characters are less than your OTP length then just ignore the new characters.
textField:shouldChangeCharactersInRange:replacementString:
I want a fully secure text entry in one of my text fields.
I set isSecureTextEntry to true
But when a user presses a key, the pressed character will pop up for the preview and I need to disable this.
Is there any way I can do that?
I know it can be turned off by the user in settings but I need to do that in code myself.
I faced with an interesting problem. In my app, I have some UITextFields that could contain only one character inside.
From iPhone 6s (iOS 9) Apple has introduced a cool feature related with force touch on keyboard text field:
http://cdn.osxdaily.com/wp-content/uploads/2016/05/iphone-keyboard-trackpad.mov.gif
In my case when the text field can contain only one character is completely useless and can be very misunderstanding.
I went through the UITextField documentation and I haven't found anything that could help me.
Do you have any ideas how to solve this problem? Is it possible?
Thanks!
UPDATE
Related with #dmorrow answer:
Setting the isSecureTextEntry to true disables that feature, but in my case I want to see the input text. So the isSecureTextEntry must be false
I just tested, and textField.isSecureTextEntry = true disables this feature.
I'm not sure how you are switching your input from number to •, but if you just use the native password input you'll get the result you need.
New Idea
What if you used a hidden textfield for the input, with isSecureTextEntry = true. Each of your input fields would actually just be a UIButton. On tapping the button, the hidden textfield would become first responder. On text input, you could set the label of the button and jump to the next button as you are doing now. Any time the user taps the button, it would clear the input and allow them to type again.
I'm working on an App with Objective-C but I have a problem with my form.
I have several inputs view (UITextField) on it, and one with a particularly behavior.
When I select the checkbox, I prevent the user typing on the view and looks the view as disable( grayed out and without the blue bar flashing blue bar ) and keep the keyboard open.
When I set the UITextField as disable, the keyboard is automatically hidden.
Someone knows how to keep the keyboard open?
I need to something like the image attached, but without the blue bar flashing blue bar.
I did the logic to prevent the the user enter data on the input , but the keyboard is automatically hidden.
If the text field is disabled, the user cannot type into it and the dismissal of the keyboard is correct. You should not try to fight against that. (It sounds like you're trying to disable the keyboard for the wrong reasons anyway.)
In this case, it sounds like your timing is just off. When the user clicks the checkbox, your code responds. What you are doing there is just wrong. You should respond by moving the first responder to the next enabled text field yourself, and then disabling the first text field. That way, you are not disabling the text field while it is first responder; that's your whole mistake right there.
We are designing a custom keyboard on iOS with a TextField (Search Field) on it.
Problem - Not able to move the focus to and fro between our custom keyboard's search field and the third party app’s search field.
when the focus comes to the custom keyboard search field it never goes back to the Parent App's search field.
PS: I have seen the keyboard apps like Popkey and Fleksy successfully doing this.
I could find out a workaround to achieve required functionality by keeping a Label instead of textField. With this work around we don't have to worry about the focus issue. Once user starts typing, we need to catch the event and update the text in label.
Hope this will help if some one is still looking for a solution to this problem.