Password textfield gets cleared on toggling show/hide password button - ios

I have a UI that includes a password entry field and a show/hide button. A tester has pointed out the following inconsistent behaviour.
If the password is hidden and half typed in (e.g. "abc") and the user hits the toggle button to show the password and continues typing then the new characters (e.g. "def") are added to the end of the initial entry (making "abcdef"). All well and good.
However, if the password is shown and half typed in (e.g. "abc") and the user hits the toggle button to hide the password and continues typing then the new characters (e.g. "def") replace the initial entry (making "def"). So the show/hide toggle not only shows or hides the text but also changes the behaviour of the UITextField (append / clear and start over) when the next character is entered.
Why is this happening?

Correct it is normal behaviour of UITextField and you can fix this using:
textField.clearsOnBeginEditing = NO;
Or in Swift:
textField.clearsOnBeginEditing = false
But it will not work if you use secure text for password.
See One of the answer:
Secure UITextField Answer

you can realization the effect you want by change your mind.
you can init a NSString *pwd to store the user's password, when user del or replace password , you change your pwd value, make sure your pwd always equal to user's typed password.
when user click the toggle button,you show the pwd value on the textfield.

Related

How to turn off character previews letter pop ups?

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.

How to set number side as default (while keyboard is open) of name phone pad keyboard type

Right now when the keyboard launches on my application it defaults to the letter side showing an alphabetical keyboard.
Question will be listed below images
Refer to image below:
This is good. Clicking 123 will show the number side.
The Question:
However, I want to by default show the number side and still be able to switch back to the letter side later WHEN THE KEYBOARD IS OPEN. How do I do this?
Setting the keyboard programmatically to a different type is NOT the answer!
For example: User clicks in the text field, keyboard pops up and defaults to let's say the ABC side. The user can click 123 to switch. This is what I want. If the ability to switch while the keyboard is open is taken away it defeats the point of this question.
So if the Name Phone Pad keyboard defaults to the ABC side initially. I want it to default to the 123 side that way while the keyboard is still open it can switch to ABC again when the user clicks ABC.
I want to do this because I have different settings for how to search for barcodes. Either by name of the product or number based on settings the user set about how to index results. This way if they are sorting by number it suggests numbers first, BUT they can still go back to searching by alphabetical if they wanted by clicking the ABC button on the keyboard.
Here is the current setting for my keyboard.
keyboardType is property for a UITextField.
textField.keyboardType = UIKeyboardType.UIKeyboardTypeNumberPad
and
textField.keyboardType = UIKeyboardType.UIKeyboardTypeDefault
is how you can switch between the two modes programatically. Hope that helps.
To switch the Keyboardlayout programmatically you have to mutate UITextfield's keyboardType attribute.
Try
textField.keyboardType = UIKeyboardType.NumberPad;
or
textField.keyboardType = UIKeyboardType.PhonePad;

Change button "username" into text field once the operation is done iOS

I'm working on profile user level, and I noticed in different apps the fact they can do what I'm going to explain below :
From profile page the new user tape on a button : username
they go to another page to choose a username
after that they go to choose password
once everything it's done they comeback to profile page
I want make the initial button username --> username textfield once the operation it's done
Thanks
Check conditions when a user has already entered his name then hide your button and when user has not entered username then hide text field. You can hide the button by using button.hidden = true and make it false if you want to show your button or a text field.

uitextfiled setSecureTextEntry is not working in ios6

I have a textfiled of secure type i.e password textfield and I have one button when I am clicking on it is showing entered password.
Here is reference code...
......
UIButton *showPwdBtn = (UIButton*)sender;
showPwdBtn.selected = !showPwdBtn.selected;
[self.passwordTextField setSecureTextEntry:!showPwdBtn.selected];
.......
But when I am doing monkey testing after clicking randomly on show password button, setSecureTextentry is not updating uitextfiled with secure type.
When user will click on Show password password will be visible and when he deselect show password button password will again change to secure (*) text.
but unfortunate its not working for monkey testing...why setSecureTextentry is not updating?
can you please try this
showPwdBtn.selected = !showPwdBtn.selected;
[self.passwordTextField setSecureTextEntry:showPwdBtn.selected];
with only one not operation

TcxMaskEdit for password field

I have a EditText declarated as TcxMaskEdit for password field and when I write on it the characters show as ***** but I want that sometimes show the characters, but I don´t find the method for that.
Have you tried simply using a normal TEdit with its PasswordChar property set as desired? You can set it to '*' when you want to hide the password, and set it to 0 when you want to show the password.
Have you tried simply using a normal TEdit with its PasswordChar property set as desired? You can set it to '*' when you want to hide the password, and set it to 0 when you want to show the password.
This perfectly works.
Then I add, answering to your doubt (Jjreina) of showing and not
First, put a SpeedButton by the side of the Edit where the password will be typed
Then in the Events of the SpeedButton
OnMouseDown
(Here you're gonna show the password when you click)
Edit2->PasswordChar=0;
2-> the number of your edit.
0-> is the default value for showing the characters on the edit
OnMouseUp
(Here you're gonna hide it again when you release the button)
Edit2->PasswordChar='*';
Change the property again to show * instead of the characters
Finally in the property Glyph of the speed button you can put an image (of an eye for example) , this just for the icing on the cake 😎
Hope it works for you, and be useful the answer

Resources